azure - 用于标记的 Azure powerhsell Runbook
问题描述
我正在尝试运行一个用于标记的 powershell runbook...
我已经开始尝试标记虚拟机,我检查了 powershell 代码并且它正在运行,我已经在 azure 门户的 powershell 控制台中逐行运行代码,它正在运行,但运行手册中的相同代码不起作用.....
............................代码..................... ............
#credentials
$CredentialAssetName = "kevin";
$Cred = Get-AutomationPSCredential -Name $CredentialAssetName;
Add-AzureRmAccount -Credential $Cred;
#----------------------------------------------------------------
#
#take tags
$r = Get-AzureRmResource -ResourceName "centos-master" -ResourceGroupName VirtualMachines;
$tags=$r.Tags;
#----------------------------------------------------------------
#assign tag to resource
$tags+=@{test3="kevin3"};
Set-AzureRmResource -ResourceGroupName "VirtualMachines" -Name "centos-master" -ResourceType "Microsoft.Compute/VirtualMachines" -Tag $tags -Force;
#----------------------------------------------------------------
提前致谢
解决方案
推荐阅读
- sql - 查询日期时间声明
- javascript - array.sort() 函数中的“无法读取未定义的属性‘formatTime’”错误
- scala - Date_format 转换为边界日期增加 1 年
- python-3.x - 使用python解析yaml
- xmpp - 如何在不发送自我存在的情况下接收消息节?
- c# - EXE中的C#调用方法
- java - setOnKeyListener 函数适用于某些手机,但不适用于其他手机
- jquery - 对 jQuery AJAX 请求进行分组以强制执行顺序
- r - Dplyr 相当于 SUM over PARTITION BY
- javascript - 如何在 javascript 中执行我的 Add 函数