无法从Azure自动化Runbook为azure虚拟机设置标记

时间:2018-04-27 10:26:50

标签: azure-virtual-machine azure-powershell azure-automation

我使用以下代码将TAG设置为我的Azure虚拟机。当我在笔记本电脑上运行它时,代码正在运行(VM正在被标记)。但是,当我从Azure自动化Runbook运行相同的代码时,虚拟机不会被标记。在Runbook执行后没有发现任何错误或警告。

代码:

$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'

0 个答案:

没有答案