0

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.

jrd1989
  • 698
  • 15
  • 48

1 Answers1

2

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]

4c74356b41
  • 628
  • 5
  • 10
  • 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 01 '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 01 '18 at 21:07
  • See [Example](https://i.imgur.com/pnthb1p.png) – Hannel Dec 02 '18 at 00:06
  • Understood. I took your advice and used -Endpoint, this was exactly what I needed. Thank you so much for the help! – jrd1989 Dec 03 '18 at 15:53
  • in this case, consider accepting this answer ;) – 4c74356b41 Dec 03 '18 at 16:00