请帮我写一个脚本来连接每个订阅来自" Get-AzureRmSubscription | ft名称"并运行Get-AzureRmOperationalInsightsWorkspace以检索分配给它的工作空间。
感谢
答案 0 :(得分:0)
以下是答案:
$subs = Get-AzureRmSubscription | Select-Object SubscriptionName, SubscriptionId
foreach($sub in $subs)
{
$subName =$sub.SubscriptionName
Set-AzureRmContext -SubscriptionName $subName | Out-Null
Write-host "Subscription Name: " $subName
Get-AzureRmResourceGroup | Format-Table ResourceGroupName
}