Regenerate Storage Account Keys
The Regenerate Keys asynchronous operation regenerates the primary or secondary access key for the specified storage account.
Request
The Regenerate Keys request may be specified as follows. Replace <subscription-id> with your subscription ID, and <service-name> with the name of the desired storage account.
Method |
Request URI |
---|---|
POST |
https://management.core.windows.net/<subscription-id>/services/storageservices/<service-name>/keys?action=regenerate |
URI Parameters
URI Parameter |
Description |
---|---|
action=regenerate |
Required. Specifies that the primary or secondary access key for the specified storage account must be regenerated. |
Request Headers
The following table describes the request headers.
Request Header |
Description |
---|---|
Content-Type |
Required. Set this header to application/xml. |
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. |
Request Body
<?xml version="1.0" encoding="utf-8"?>
<RegenerateKeys xmlns="https://schemas.microsoft.com/windowsazure">
<KeyType>Primary|Secondary</KeyType>
</RegenerateKeys>
The following table describes the elements of the request body.
Element Name |
Description |
---|---|
KeyType |
Specifies which key to regenerate. Valid values are:
|
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).
Response Headers
The response for this operation includes the following headers. The response may also include additional standard HTTP headers.
Response Header |
Description |
---|---|
x-ms-request-id |
A value that uniquely identifies a request made against the management service. For an asynchronous operation, you can call Get Operation Status with the value of the header to determine whether the operation is complete, has failed, or is still in progress. |
Response Body
<?xml version="1.0" encoding="utf-8"?>
<StorageService xmlns="https://schemas.microsoft.com/windowsazure">
<Url>storage-service-request-uri</Url>
<StorageServiceKeys>
<Primary>primary-key</Primary>
<Secondary>secondary-key</Secondary>
</StorageServiceKeys>
</StorageService>
The following table describes the 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. |
Primary |
The primary key for the specified storage account. |
Secondary |
The secondary key for the specified storage account. |
Remarks
The Regenerate Storage Account Keys operation causes the Primary or Secondary key for a storage account service to be regenerated. This operation can be used with the storage accounts returned by the List Storage Accounts operation, to automate management of storage key updates.