2017-07-24 93 views
1

我在Azure上的自動化運行手冊試圖動手,下面是小腳本我使用創建一個存儲帳戶。無法創建存儲帳戶直通蔚藍的自動化運行手冊

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 
} 

然而,當過我出版後運行,作業完成與錯誤 (新AzureRmStorageAccount:參數無法找到匹配的參數名稱「SkuName」)

誰能告訴我,我什麼我做錯了什麼?

+0

你有'-Name'之後結束的行?你應該修復它 – 4c74356b41

+0

它的一個完整的陳述( 新AzureRmStorageAccount -ResourceGroupName $ AzureResourceGroup雜牌$ StorageAC -Location $祿-SkuName $ SKU)和沒有括號或支架懸空 – GavinAzure

回答

1

要解決的錯誤:

New-AzureRmStorageAccount : A parameter cannot be found that matches parameter name 'SkuName' 

請更新您自動化帳戶Azure的模塊,並通過點擊:在自動化帳戶=>模塊「更新Azure的模塊」,然後重試運行手冊

Update Azure Modules

+0

感謝ü的sooo多... ...它的工作。 ..我花了一整天想出來的! – GavinAzure