0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AzureからAzure Arcで接続されたマシン上でスクリプトを実行する方法

Posted at

はじめに

Azure上の仮想マシンであれば、Run Command機能を使ってスクリプトを実行することができるのですが、Azure Arcで接続されたマシンには現状Run Commandのメニューがないためその方法が使えません。そこでAzure Automation Hybrid Workerを使うことでAzure Automation PowerShellやPython runbooksをAzure Arcで接続されたサーバー上で直接実行することができます。

手順

Hybrid Worker Groupsを作成する

以下のようにHybrid Worker Groupを作成します。またHybrid Worker Groupsに追加するマシン(=スクリプトを実行したいマシン)を選択します。
hybridworker.png

Azure Automation Runbookを作成する

Runbookを作成します。今回はHostnameを使って本当にAzure Arc接続マシン上でコマンドが実行されているのかを確認してみます。
createrunbook.png
hostname.png

Azure Arcマシン上でスクリプトを実行する

Start RunbookでHybrid Workerを選択し、スクリプトの実行基盤を選択します。これは一回実行する場合に使います。定期実行やスケジュールした処理をしたい場合は”Link to Schedules”を使用します。
Startrunbook.png

ちゃんと選択したオンプレミス基盤でスクリプトを実行したことが確認できました。
resultrunbook.png

まとめ

Azure Arcで接続されたマシン上でスクリプトを実行する方法を確認しました。今回の方法では拡張機能ベースのHybrid Runbook Worker(V2)を使った方法を紹介しましたが、もしLog Analytics AgentベースのHybrid Runbook Worker(V1)をご利用の場合は2024年8月31日に廃止予定ですのでご注意ください。

参考

Run PowerShell Scripts with Azure Automation Hybrid Workers on-premises using Azure Arc

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?