I'm trying to run a powershell command to list the blobs in a container. I found this command and modified it as needed:

$ctx = New-AzureStorageContext -StorageAccountName [name].blob.core.usgovcloudapi.net -StorageAccountKey [key] Get-AzureStorageContainer -Context $ctx

The following error is returned - Get-AzureStorageContainer : The remote name could not be resolved: '.blob.core.usgovcloudapi.net.blob.core.windows.net'

I don't understand why powershell is appending the cloudapi.net.blob.core.windows.net. Is there a way to force powershell not to do this? As you can tell im working with Azure Government.


you need to just use [name] as an argument to -StorageAccountName. it will append to that automatically. so replace [name].blob.core.usgovcloudapi.net with [name]

| improve this answer | |
  • Even when I specify a variable and assigned the full name of my storage account, ex: xxxxx.blob.core.usgovcloudapi.net, the additional blob.core.windows.net is appended to the end so it comes out as xxxxx.blob.core.usgovcloudapi.net.blob.core.windows.net. I tried -StorageAccountName $storageaccountvariable.equals('xxxxx.blob.core.usgovcloudapi.net') but that didn't work either. – jrd1989 Dec 1 '18 at 20:48
  • 2
    you dont need full name, you only need everything before .blob.core.windows.net (only NAME, not full url), if you are using gov cloud you need to use endpoint parameter, something like: -Endpoint "core.usgovcloudapi.net" – 4c74356b41 Dec 1 '18 at 21:07
  • See Example – Hannel Dec 2 '18 at 0:06
  • Understood. I took your advice and used -Endpoint, this was exactly what I needed. Thank you so much for the help! – jrd1989 Dec 3 '18 at 15:53
  • in this case, consider accepting this answer ;) – 4c74356b41 Dec 3 '18 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.