Using Azure File Storage with Azure Government


So you have looked at the docs and you would like to give Azure File Storage a try, but you are having trouble connecting it to Azure Government following the instructions posted on the public Azure site?
http://azure.microsoft.com/en-us/services/storage/files/

Let me guess you are getting an error that says:
“The Remote name could not be resolved: ‘youracount.file.core.windows.net’”

Fear not the Azure Government Blog to the rescue!

It is an easy fix, just add the –Endpoint argument with the value of "core.usgovcloudapi.net" to your PowerShell and you should be good to go!

The full commands should look something like this:

$ctx=New-AzureStorageContext -StorageAccountName "<<MyAccount>>" -StorageAccountKey "<<MyKey>>" -Endpoint "core.usgovcloudapi.net"
$s = New-AzureStorageShare <<MyShare>> -Context $ctx
New-AzureStorageDirectory -Share $s -Path MyDir

net use z: \\<<MyAccount>>.file.core.usgovcloudapi.net\<<MyShare>> /u:<<MyAccount>> <<MyKey>>

Happy File Sharing 

Comments (1)

  1. Anonymous says:

    Found this just in time! 🙂  

    Having tooling break because of trying to work with the gov cloud was driving me crazy until I found Endpoint for StorageContext and EndpointSuffix for our StorageConnectionStrings.

    Thanks Shawn!

    Z

Skip to main content