我正在尝试使用azure自动化Runbook,下面是我用来创建存储帐户的小脚本。
Param
(
[Parameter(Mandatory=$true)]
[String]
$AzureResourceGroup,
[Parameter(Mandatory=$true)]
[String]
$StorageAC,
[Parameter(Mandatory=$true)]
[String]
$Loc,
[Parameter(Mandatory=$true)]
[String]
$sku
)
$CredentialAssetName = "AutomationAccount";
$Cred = Get-AutomationPSCredential -Name $CredentialAssetName
if(!$Cred) {
Throw "Could not find an Automation Credential Asset named
'${CredentialAssetName}'. Make sure you have created one in this Automation
Account."
}
Add-AzureRmAccount -Credential $Cred
Add-AzureAccount -Credential $Cred
$storeac = Get-AzureRmStorageAccount -ResourceGroupName $AzureResourceGroup
if ($storeac.StorageAccountName -eq "testdd" ){
write-output " AC found !";
} else {
New-AzureRmStorageAccount -ResourceGroupName $AzureResourceGroup -Name
$StorageAC -Location $Loc -SkuName $sku
}
然而,当我在发布后运行它时,作业完成并出现错误 (New-AzureRmStorageAccount:找不到与参数名称'SkuName'匹配的参数)
有人能告诉我我做错了什么吗?
答案 0 :(得分:1)
解决错误:
New-AzureRmStorageAccount : A parameter cannot be found that matches parameter name 'SkuName'
请更新自动化帐户中的Azure模块,然后单击“自动帐户”下的“更新Azure模块”=>模块并重试Runbook