Azure ARM環境にてRestAPIを使用したVMの一括起動/停止を実現しようとしています。
現在、以下のコマンドにて実現しようとしているのですが、
どのようなJSONを投げればよいかわからず困っています。
実現したい内容は、特定のリソースグループ内の仮想マシン名をget-azurermvmにて取得し
取得したVM全てを起動/停止する という内容になります。
$method = "PUT"
$resourgegroup = "<リソースグループ名>"
$newserver="<サーバー名>"
$requestHeader = @{
"x-ms-version" = "2014-04-01";
"Authorization" = $authHeader;
"Accept" = "application/json"
}
#<わからない部分>
$json = わからない部分
[byte[]]$requestBody = [System.Text.Encoding]::UTF8.GetBytes($json)
$apiurl = "https://management.azure.com/subscriptions/$subscriptionid/resourceGroups/$resourgegroup/providers/Microsoft.Sql/servers/$($newserver)?api-version=2014-04-01"
$ret = Invoke-RestMethod -Verbose -Uri $apiurl -Method $method -Headers $requestHeader -ContentType $contentType -Body $requestBody
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/07/15 04:33
2017/07/19 02:06
2017/07/20 06:04
2017/07/24 04:37
2017/07/24 05:53
2017/07/25 00:48