locked
Azure cloud storage account with custom endpoint suffix RRS feed

  • Question

  • Hello,

    Imagine, we have 2 Azure storage accounts, one of them is regular, other one - Government (or Germany, Chine etc.). Here is how we create CloudBlobClient:

        private const string ConnectionStringTemplate = "DefaultEndpointsProtocol={0};AccountName={1};AccountKey={2};";
    
        public static CloudBlobClient Create(string protocol, string accountName, string accountKey)
        {
            var connectionString = string.Format(CultureInfo.InvariantCulture, ConnectionStringTemplate, protocol, accountName, accountKey);
            var account = CloudStorageAccount.Parse(connectionString);
    
            return account.CreateCloudBlobClient();
        }

    This code works fine for regular account, but for Government one doesn't. We should specify EndpointSuffix (core.usgovcloudapi.net instead of core.windows.net which is default), and connection string should be like this:

    "DefaultEndpointsProtocol={0};AccountName={1};AccountKey={2};EndpointSuffix={3}";

    So, the question is, how can I know which account is if have only AccountName and AccountKey? Is there some API method to check account type or endpoint suffix for them?

    Thanks.


    • Edited by DevForRest Wednesday, June 21, 2017 12:54 PM Formatting
    Wednesday, June 21, 2017 12:52 PM

Answers

  • The short answer is NO, there is no such API to check which account type is.

    From other forum:

    There isn't such an API to do that since your accounts are across different clouds and Azure APIs are always serving within one cloud. Actually, you can even create accounts with the same name across different clouds. Therefore, you need to maintain the "account, cloud name (public Azure/China/Germany Gov)" mapping by yourself.

    • Marked as answer by DevForRest Monday, June 26, 2017 9:51 AM
    Monday, June 26, 2017 9:51 AM

All replies

  • The short answer is NO, there is no such API to check which account type is.

    From other forum:

    There isn't such an API to do that since your accounts are across different clouds and Azure APIs are always serving within one cloud. Actually, you can even create accounts with the same name across different clouds. Therefore, you need to maintain the "account, cloud name (public Azure/China/Germany Gov)" mapping by yourself.

    • Marked as answer by DevForRest Monday, June 26, 2017 9:51 AM
    Monday, June 26, 2017 9:51 AM
  • Glad you found the right answer and thanks for getting back to update the thread. It should help those looking for similar information.

    -----------------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.

    Thursday, June 29, 2017 8:05 AM