SALES: 1-800-867-1380

Get Storage Account Properties

Updated: July 23, 2014

The Get Storage Account Properties operation returns system properties for the specified storage account.

The Get Storage Account Properties request may be specified as follows. Replace <subscription-id> with your subscription ID, and <storage-account-name> with the name of the storage account.

 

Method Request URI

GET

https://management.core.windows.net/<subscription-id>/services/storageservices/<storage-account-name>

You must make sure that the request that is made to the management service is secure. For additional details, see Authenticating Service Management Requests.

The following table describes the request headers.

 

Request Header Description

x-ms-version

Required. Specifies the version of the operation to use for this request. This header should be set to 2009-10-01 or higher. For more information about versioning headers, see Service Management Versioning.

The response includes an HTTP status code, a set of response headers, and a response body.

A successful operation returns status code 200 (OK). For information about status codes, see Service Management Status and Error Codes.

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

 

Response Header Description

x-ms-request-id

A value that uniquely identifies a request made against the management service.

The format of the response body is as follows:


<?xml version="1.0" encoding="utf-8"?>
<StorageService xmlns="http://schemas.microsoft.com/windowsazure">
  <Url>storage-account-request-uri</Url>
  <ServiceName>storage-account-name</ServiceName>
  <StorageServiceProperties>
    <Description>description</Description>
    <AffinityGroup>affinity-group</AffinityGroup>
    <Location>location</Location>
    <Label>base64-encoded-label</Label>  
    <Status>status</Status>
    <Endpoints>
      <Endpoint>storage-service-blob-endpoint</Endpoint>
      <Endpoint>storage-service-queue-endpoint</Endpoint>
      <Endpoint>storage-service-table-endpoint</Endpoint>
      <Endpoint>storage-service-file-endpoint</Endpoint>
    </Endpoints>
    <GeoReplicationEnabled>geo-replication-indicator</GeoReplicationEnabled>
    <GeoPrimaryRegion>primary-region</GeoPrimaryRegion> 
    <StatusOfPrimary>primary-status</StatusOfPrimary>
    <LastGeoFailoverTime>DateTime</LastGeoFailoverTime>  
    <GeoSecondaryRegion>secondary-region</GeoSecondaryRegion>  
    <StatusOfSecondary>secondary-status</StatusOfSecondary>
    <CreationTime>time-of-creation</CreationTime>
    <CustomDomains>
      <CustomDomain>
        <Name>name-of-custom-domain</Name>
      </CustomDomain>
    </CustomDomains>
    <SecondaryReadEnabled>secondary-read-indicator</SecondaryReadEnabled>
    <SecondaryEndpoints>
      <Endpoint>storage-secondary-service-blob-endpoint</Endpoint>
      <Endpoint>storage-secondary-service-queue-endpoint</Endpoint>
      <Endpoint>storage-secondary-service-table-endpoint</Endpoint>
    </SecondaryEndpoints>
  </StorageServiceProperties>
  <ExtendedProperties>
    <ExtendedProperty>
      <Name>property-name</Name>
      <Value>property-value</Value>
    </ExtendedProperty>
  </ExtendedProperties>
  <Capabilities>
    <Capability>storage-account-capability</Capability>
  </Capabilities>
  <AccountType>type-of-storage-account</AccountType>
</StorageService>

The following table describes the elements of the response body.

 

Element name Description

Url

Specifies the URI of the storage account.

ServiceName

Specifies the name of the storage account. This name is the DNS prefix name and can be used to access blobs, queues, and tables in the storage account.

For example, if the service name is MyStorageAccount you could access the blob containers by calling: http://MyStorageAccount.blob.core.windows.net/mycontainer/

StorageServiceProperties

Specifies the properties of the storage account.

ExtendedProperties

Specifies the name and value of an extended property that was added to the storage account.

Capability

Indicates whether the storage account is able to perform virtual machine related operations. If so, this element returns a string containing PersistentVMRole. Otherwise, this element will not be present.

The Capability element is only available using version 2012-03-01 or higher.

AccountType

Specifies whether the account supports local-redundant storage, geo-redundant storage, or read access geo-redundant storage.

Possible values are:

  • Standard-LRS

  • Standard-GRS

  • Standard-RAGRS

The AccountType element is only available using version 2012-03-01 or higher and it replaces the SecondaryReadEnabled and GeoReplicationEnabled elements.

Specifies the properties of the storage account.

 

Element name Description

Description

Optional. A description for the storage account. The description can be up to 1024 characters in length.

The Description element is only available using version 2012-03-01 or higher.

AffinityGroup

Required if Location is not specified. The name of an existing affinity group associated with this subscription. This name is a GUID and can be retrieved by examining the name element of the response body returned by the List Affinity Groups operation.

The AffinityGroup element is only available using version 2012-03-01 or higher.

Location

Required if AffinityGroup is not specified. The location where the storage account will be created.

The Location element is only available using version 2012-03-01 or higher.

Label

Required. A name for the hosted service that is base-64 encoded. The name can be up to 100 characters in length. The name can be used identify the storage account for your tracking purposes.

The Label element is only available using version 2012-03-01 or higher.

Status

The status of the storage account. Possible values are:

  • Creating

  • Created

  • Deleting

  • Deleted

  • Changing

  • ResolvingDns

The Status element is only available using version 2012-03-01 or higher.

Endpoints

Specifies the endpoints of the storage account.

GeoReplicationEnabled

Indicates whether the data in the storage account is replicated across more than one geographic location so as to enable resilience in the face of catastrophic service loss. The value is true if geo-replication is enabled; otherwise false.

The GeoReplicationEnabled element is only available using version 2012-03-01 or higher and is replaced by the AccountType element after version 2014-06-01.

GeoPrimaryRegion

Indicates the primary geographical region in which the storage account exists at this time.

The GeoPrimaryRegion element is only available using version 2012-03-01 or higher.

StatusOfPrimary

Indicates whether the primary storage region is available.

Possible values are:

  • Available

  • Unavailable

The StatusOfPrimary element is only available using version 2013-11-01 or higher.

LastGeoFailoverTime

A timestamp that indicates the most recent instance of a failover to the secondary region. In case of multiple failovers only the latest failover date and time maintained.

The format of the returned timestamp is: [4DigitYear]-[2DigitMonth]-[2DigitDay]T[2DigitMinute]:[2DigitSecond]:[7DigitsOfPrecision]Z

For example: <LastGeoFailoverTime>2010-01-18T13:15:30.0000000Z</LastGeoFailoverTime>

LastGeoFailoverTime is not returned if there has not been an instance of a failover.

The LastGeoFailoverTime element is only available using version 2012-03-01 or higher.

GeoSecondaryRegion

Indicates the geographical region in which the storage account is being replicated.

The GeoSecondaryRegion element is not returned if geo-replication is “off” for this account.

The GeoSecondaryRegion element is only available using version 2012-03-01 or higher.

StatusOfSecondary

Indicates whether the secondary storage region is available.

Possible values are:

  • Available

  • Unavailable

The StatusOfSecondary element is only available using version 2013-11-01 or higher.

CreationTime

Specifies the time that the storage account was created.

CustomDomains

Specifies the custom domains that are associated with the storage account.

The CustomDomains element is only available using version 2013-06-01 or higher.

SecondaryReadEnabled

Indicates that secondary read is enabled for the storage account.

Possible values are:

  • true

  • false

The SecondaryReadEnabled element is only available using version 2013-11-01 or higher and is replaced by the AccountType element after version 2014-06-01.

SecondaryEndpoints

Specifies the secondary endpoints of the storage account.

The SecondaryEndpoints element is only available using version 2013-11-01 or higher.

Specifies the endpoints of the storage account.

 

Element name Description

Endpoint

Contains the blob service endpoint in the following format: https:// <storage-service-name>.blob.core.windows.net

The Endpoint element is only available using version 2012-03-01 or higher. Http endpoints, are returned with version 2014-04-01 or lower.

Endpoint

Contains the queue service endpoint in the following format: https:// <storage-service-name>.queue.core.windows.net

The Endpoint element is only available using version 2012-03-01 or higher. Http endpoints, are returned with version 2014-04-01 or lower.

Endpoint

Contains the table service endpoint in the following format: https://<storage-service-name>.table.core.windows.net

The Endpoint element is only available using version 2012-03-01 or higher. Http endpoints, are returned with version 2014-04-01 or lower.

Endpoint

Contains the file service endpoint in the following format: https://<storage-service-name>.file.core.windows.net

The Endpoint element is only available using version 2012-03-01 or higher. Http endpoints, are returned with version 2014-04-01 or lower.

Specifies the custom domains that are associated with the storage account.

 

Element name Description

CustomDomain

Specifies information about a custom domain that is associated with the storage account.

Name

Specifies the name of the custom domain.

Specifies the secondary endpoints of the storage account.

 

Element name Description

Endpoint

Contains the blob secondary service endpoint in the following format: https://<storage-secondary-service-name>.blob.core.windows.net

Http endpoints, are returned with version 2014-04-01 or lower.

Endpoint

Contains the queue service endpoint in the following format: https://<storage-secondary-service-name>.queue.core.windows.net

Http endpoints, are returned with version 2014-04-01 or lower.

Endpoint

Contains the table service endpoint in the following format: https://<storage-secondary-service-name>.table.core.windows.net

Http endpoints, are returned with version 2014-04-01 or lower.

Specifies the name and value of an extended property that was added to the storage account.

 

Element name Description

Name

Optional. Represents the name of an extended storage account property. Each extended property must have both a defined name and value. You can have a maximum of 50 extended property name/value pairs.

The maximum length of the Name element is 64 characters, only alphanumeric characters and underscores are valid in the Name, and the name must start with a letter. Attempting to use other characters, starting the Name with a non-letter character, or entering a name that is identical to that of another extended property owned by the same storage account, will result in a status code 400 (Bad Request) error.

The Name element is only available using version 2012-03-01 or higher.

Value

Optional. Represents the value of an extended storage account property. Each extended property must have both a defined name and value. You can have a maximum of 50 extended property name/value pairs, and each extended property value has a maximum length of 255 characters.

The Value element is only available using version 2012-03-01 or higher.

Geo-replication can be enabled when you create or update a storage account.

If the x-ms-version is 2012-03-01 or higher and the affinity group was created in one of the deprecated Anywhere US, Anywhere Europe, Anywhere Asia regions, the Location element will return the location where this affinity group is allocated.

The following example program takes the subscription ID, an associated management certificate thumbprint, the operation version string, and a storage account name, and prints the returned storage account properties to the console. Initialize the msVersion, subscriptionId, thumbprint and serviceName variables with your own values to run the example code.

using System;
using System.Collections.Generic;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Xml;
using System.Xml.Linq;
 
class Program
{
    static void Main(string[] args)
    {
        string msVersion = "2011-12-01";
        string subscriptionId = "subscription-id-guid";
        string thumbprint = "certificate-thumbprint";
        string serviceName = "myexamplestorage1";
        try
        {
            // Obtain the certificate with the specified thumbprint
            X509Certificate2 certificate = GetCertificate(thumbprint);
            GetStorageAccountPropertiesExample(
                subscriptionId, certificate, msVersion, serviceName);
        }
        catch (Exception ex)
        {
            Console.WriteLine("Exception caught in Main:");
            Console.WriteLine(ex.Message);
        }
    }
 
    public static X509Certificate2 GetCertificate(string thumbprint)
    {
        List<StoreLocation> locations = new List<StoreLocation> 
            { StoreLocation.CurrentUser, StoreLocation.LocalMachine };
 
        foreach (var location in locations)
        {
            X509Store store = new X509Store("My", location);
            try
            {
                store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
                X509Certificate2Collection certificates =
                    store.Certificates.Find(
                        X509FindType.FindByThumbprint,
                        thumbprint, false);
                if (certificates.Count == 1)
                {
                    return certificates[0];
                }
            }
            finally
            {
                store.Close();
            }
        }
 
        throw new ArgumentException(string.Format(
            "A certificate with thumbprint '{0}' could not be located.",
            thumbprint));
    }
 
    public static void GetStorageAccountPropertiesExample(
        string subscriptionId,
        X509Certificate2 certificate,
        string version,
        string serviceName)
    {
        string uriFormat = "https://management.core.windows.net/{0}/services/storageservices/{1}";
        Uri uri = new Uri(String.Format(uriFormat, subscriptionId, serviceName));
 
        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
        request.Method = "GET";
        request.Headers.Add("x-ms-version", version);
        request.ClientCertificates.Add(certificate);
        request.ContentType = "application/xml";
 
        XDocument responseBody = null;
        HttpStatusCode statusCode;
        HttpWebResponse response;
        try
        {
            response = (HttpWebResponse)request.GetResponse();
        }
        catch (WebException ex)
        {
            // GetResponse throws a WebException for 400 and 500 status codes
            response = (HttpWebResponse)ex.Response;
        }
        statusCode = response.StatusCode;
        if (response.ContentLength > 0)
        {
            using (XmlReader reader = XmlReader.Create(response.GetResponseStream()))
            {
                responseBody = XDocument.Load(reader);
            }
        }
        response.Close();
        if (statusCode.Equals(HttpStatusCode.OK))
        {
            XNamespace wa = "http://schemas.microsoft.com/windowsazure";
            XElement storageService = responseBody.Element(wa + "StorageService");
            Console.WriteLine(
                "Storage Account Properties for {0}:{1}{2}",
                serviceName, Environment.NewLine, 
                storageService.ToString(SaveOptions.OmitDuplicateNamespaces));
        }
        else
        {
            Console.WriteLine("Call to GetStorageAccountProperties returned an error:");
            Console.WriteLine("Status Code: {0} ({1}):{2}{3}",
                (int)statusCode, statusCode, Environment.NewLine,
                responseBody.ToString(SaveOptions.OmitDuplicateNamespaces));
        }
        return;
    }
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft