2016-12-05 2 views
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. 

답변

1
$Ctx = New-AzureStorageContext $StorageAccountName -StorageAccountKey 
$StorageAccountKey.value[0] 

쉽게 $StorageAccount | Get-Member

+0

이 자신을 알아낼 수있다 그러나 밖으로 cu의 일했다 riosity는'$ StorageAccountKey.Primary' 또는'$ StorageAccountKey.key1'을 사용하여 문제를 알고 싶었습니다. –

+1

글쎄, 나는 당신에게 설명했다. '$ StorageAccountKey' 객체는 더 이상 그 속성들을 가지고 있지 않습니다. 당신 자신을 체크 할 수 있습니다. gm'과 참조하십시오. – 4c74356b41