Get Storage Account Properties
Updated: June 7, 2012
The Get Storage Account Properties operation returns system properties for the specified storage account.
Request
The Get Storage Account Properties request may be specified as follows. Replace <subscription-id> with your subscription ID, and <service-name> with the name of your service:
| Method | Request URI | HTTP Version |
|---|---|---|
|
GET |
|
HTTP/1.1 |
URI Parameters
None.
Request Headers
The following table describes required and optional 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 later. The current version is 2012-03-01. For more information about versioning headers, see Service Management Versioning. |
Request Body
None.
Response
The response includes an HTTP status code, a set of response headers, and a response body.
Status Code
A successful operation returns status code 200 (OK).
For information about status codes, see Service Management Status and Error Codes.
Response Headers
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. |
Response Body
The format for the 2012-03-01version 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>http://{storage-service-name}.blob.core.windows.net/</Endpoint>
<Endpoint>http://{storage-service-name}.queue.core.windows.net/</Endpoint>
<Endpoint>http://{storage-service-name}.table.core.windows.net/</Endpoint>
</Endpoints>
<GeoReplicationEnabled>[true|false]</GeoReplicationEnabled>
<GeoPrimaryRegion>primary-region</GeoPrimaryRegion>
<StatusOfPrimary>[Available|Unavailable]</StatusOfPrimary>
<LastGeoFailoverTime>DateTime</LastGeoFailoverTime>
<GeoSecondaryRegion>secondary-region</GeoSecondaryRegion>
<StatusOfSecondary>[Available|Unavailable]</StatusOfSecondary>
</StorageServiceProperties>
<ExtendedProperties>
<ExtendedProperty>
<Name>property-name</Name>
<Value>property-value</Value>
</ExtendedProperty>
</ExtendedProperties>
<Capabilities>
<Capability>storage-account-capability</Capability>
</Capabilities>
</StorageService>
The following table describes the key elements of the response body:
| Element name | Description | ||
|---|---|---|---|
|
Url |
The Service Management API request URI used to perform Get Storage Account Properties requests against the storage account. |
||
|
Description |
The user supplied description of the storage account. |
||
|
AffinityGroup |
The affinity group with which this storage account is associated. |
||
|
Location |
The geo-location specified when the storage account was created. This property is only returned if the storage account is not associated with an affinity group. |
||
|
Label |
The user supplied name of the storage account returned as a base-64 encoded string. This name can be used identify the storage account for your tracking purposes. |
||
|
Status |
The status of the storage account at the time the operation was called.
|
||
|
Endpoint |
The URLs that are used to perform a retrieval of a public blob, queue, or table object.
|
||
|
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.
|
||
|
GeoPrimaryRegion |
Indicates the primary geographical region in which the storage account exists at this time. Possible values are:
|
||
|
StatusOfPrimary |
Indicates whether the primary storage region is available. Possible values are:
|
||
|
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.
|
||
|
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. Possible values are:
|
||
|
StatusOfSecondary |
Indicates whether the secondary storage region is available. Possible values are:
|
||
|
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 |
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 has a maximum value of 255. The Value element is only available using version 2012-03-01 or higher. |
||
|
Capability |
Indicates if 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. |
Authorization
Any management certificate associated with the subscription specified by <subscription-id> can be used to authenticate this operation. For additional details, see Authenticating Service Management Requests.
Remarks
Geo-replication can be enabled when you create or update a storage account.
If the x-ms-version is 2012-03-01 or later 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.
Example
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; } }
When run, the program output will look something like the following sample:
Storage Account Properties for myexamplestorage1:
<StorageService xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Url>https://management.core.windows.net/01234567-89ab-cdef-0123-456789abcdef/services/storageservices/myexamplestorage1</Url>
<ServiceName>myexamplestorage1</ServiceName>
<StorageServiceProperties>
<Description>myexamplestorage1 description</Description>
<Location>North Central US</Location>
<Label>TXkgRXhhbXBsZSBMYWJlbA==</Label>
<Status>Created</Status>
<Endpoints>
<Endpoint>http://myexamplestorage1.blob.core.windows.net/</Endpoint>
<Endpoint>http://myexamplestorage1.queue.core.windows.net/</Endpoint>
<Endpoint>http://myexamplestorage1.table.core.windows.net/</Endpoint>
</Endpoints>
<GeoReplicationEnabled>true</GeoReplicationEnabled>
<GeoPrimaryRegion>usnorth</GeoPrimaryRegion>
<StatusOfPrimary>Available</StatusOfPrimary>
<GeoSecondaryRegion>ussouth</GeoSecondaryRegion>
<StatusOfSecondary>Available</StatusOfSecondary>
</StorageServiceProperties>
</StorageService>
Note