找到你要的答案

Q:Accessing Azure Storage services from a different subscription

Q:从不同订阅访问Azure存储服务

We are looking to deploy our Azure cloud services to multiple subscriptions but want to be able to be able to access the same Storage accounts for storing blobs and tables. Wanted to know if it is possible to access storage accounts from across different subscriptions using just the storage account name and key? Our data connection takes the form

Trying to use the above and it always try to find end point for given accountname within the current subscription

We are looking to deploy our Azure cloud services to multiple subscriptions but want to be able to be 能够访问相同的存储帐户 for storing blobs and tables. Wanted to know if it is possible to access storage accounts from across different subscriptions using just the storage account name and key? Our data connection takes the form

试图用以上,它总是设法找到在当前订阅特定帐户名终点

answer1: 回答1:

If i understood your question...

able to access the same Storage accounts

  • Via Azure Panel (Management Portal) : you can access the storage account only in the subscription.
  • Via Visual Studio: you can attach storage account outside your current login account in visual studio <-> azure with account name and key (and manage it) enter image description here
  • Via Code: You can access storage account (blob, queue, table) from all your apps with storage connection strings (don't put it in code)

If you want, you can restrict blob access with CORS settings. Something like this :

  private static void InitializeCors()
    {
        ServiceProperties blobServiceProperties = blobClient.GetServiceProperties();

        //Attiva e Configura CORS
        ConfigureCors(blobServiceProperties);

        //Setta
        blobClient.SetServiceProperties(blobServiceProperties);
    }

    private static void ConfigureCors(ServiceProperties prop)
    {
        var cors = new CorsRule();
        cors.AllowedOrigins.Add("www.domain1.net, www.domain2.it");
        prop.Cors.CorsRules.Add(cors);
    }

如果我理解你的问题…

能够访问相同的存储帐户

  • Via Azure Panel (Management Portal) : you can access the storage account only in the subscription.
  • Via Visual Studio: you can attach storage account outside your current login account in visual studio <-> azure with account name and key (and manage it) enter image description here
  • Via Code: You can access storage account (blob, queue, table) from all your apps with storage connection strings (don't put it in code)

如果你想,你可以设置限制访问BLOB CORS。像这样的东西:

  private static void InitializeCors()
    {
        ServiceProperties blobServiceProperties = blobClient.GetServiceProperties();

        //Attiva e Configura CORS
        ConfigureCors(blobServiceProperties);

        //Setta
        blobClient.SetServiceProperties(blobServiceProperties);
    }

    private static void ConfigureCors(ServiceProperties prop)
    {
        var cors = new CorsRule();
        cors.AllowedOrigins.Add("www.domain1.net, www.domain2.it");
        prop.Cors.CorsRules.Add(cors);
    }
azure  windows-azure-storage