none
Accessing Read-access geo-redundant storage (RA-GRS)

    Question

  • How do i access the secondary Read-access geo-redundant storage (RA-GRS)?

    I can access the Blob Storage using example.blob.core.windows.net but if I add example-secondary I get an error. 

    This connects: example.blob.core.windows.net 

    This does not: example-secondary.blob.core.windows.net

    In the meantime I temporarily converted the access type on the container to blob after which I was able to download my file using both links https://example1.blob.core... and https://example1-secondary.blo.... However this means anyone can access those URLs and download the data.  I know I can access Shared Access Signatures to secure the data however I would prefer the standard way of accessing the read only storage account as I would like to perform SQL data restores directly from the files available on the read only account using the SQL restore from URL option instead of having to download the data locally first.

    Many thanks

    Narayn


    Monday, April 11, 2016 10:13 AM

All replies

  • How are you trying to retrieve data from the secondary, and what error are you getting?

    You have the format of the secondary correct.

    I just wrote some code to do this on an RA-GRS account, and it worked just fine. Here's my code. Note that the thread sleeps for five minutes to allow the secondary to update, which was sufficient when I just tried it. However, it may take up to fifteen minutes for the secondary to update. The interval is not guaranteed.

    // Retrieve storage account from connection string.
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
    CloudConfigurationManager.GetSetting("StorageConnectionString"));
    
    // Create the blob client.
    CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
    
    // Retrieve a reference to a container.
    CloudBlobContainer container = blobClient.GetContainerReference("mycontainer" + DateTime.Now.Ticks);
    
    // Create the container if it doesn't already exist.
    container.CreateIfNotExists();
    
    // Retrieve reference to a blob named "myblob.txt".
    CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob.txt");
    
    blockBlob.UploadText("myblob");
    
    Console.WriteLine("primary URI: {0}", blockBlob.StorageUri.PrimaryUri);
    
    System.Threading.Thread.Sleep(300000);
    
    Console.WriteLine("secondary URI: {0}", blockBlob.StorageUri.SecondaryUri);
    

    Monday, April 11, 2016 11:50 PM