【发布时间】:2018-10-08 04:22:20
【问题描述】:
我正在使用以下代码为我的 Azure 虚拟机设置 TAG。当我在笔记本电脑上运行代码时(VM 被标记),该代码正在运行。但是,当我从 Azure 自动化运行手册运行相同的代码时,虚拟机没有被标记。运行手册执行后未观察到错误或警告。
代码:
$resource_group = "agentinstall-poc"
$tags = (Get-AzureRmResource -ResourceGroupName $resource_group -Name "client-2").Tags
$tags += @{manju="rao"}
Set-AzureRmResource -ResourceGroupName $resource_group -Name "client-2" -ResourceType "Microsoft.Compute/VirtualMachines" -Tag $tags -Force -ApiVersion '2015-06-15'
【问题讨论】:
-
可能由于安装在本地计算机上的 Azure PS 版本与 azure runbook 使用的版本不同而发生
-
您是否在 Runbook 中使用您的 RunAs 帐户之一?
标签: azure-virtual-machine azure-powershell azure-automation