0
以下代碼直到昨天才正常工作,但今天它正在給我一個如下所述的錯誤。將StorageAccount密鑰傳遞到新的上下文時出錯
$StorageAccountName = "xyz"
$StorageAccountKey = Get-AzureRmStorageAccountKey -StorageAccountName $StorageAccountName
$Ctx = New-AzureStorageContext $StorageAccountName -StorageAccountKey $StorageAccountKey.Primary
試圖與
$Ctx = New-AzureStorageContext $StorageAccountName -StorageAccountKey $StorageAccountKey.key1
這裏替換上面代碼的最後一行的錯誤:
New-AzureStorageContext : Cannot validate argument on parameter 'StorageAccountKey'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
這已經工作,但缺乏riosity想知道使用'$ StorageAccountKey.Primary'或'$ StorageAccountKey.key1' –
這個問題,我已經給你解釋了。 '$ StorageAccountKey'對象不再具有這些屬性,您可以檢查自己,執行'| gm'然後看。 – 4c74356b41