11.08.2020

Azure Generate Storage Account Key

Azure Generate Storage Account Key 4,5/5 9008 reviews
-->

When you create a storage account, Azure generates two 512-bit storage account access keys. These keys can be used to authorize access to data in your storage account via Shared Key authorization.

Microsoft recommends that you use Azure Key Vault to manage your access keys, and that you regularly rotate and regenerate your keys. Using Azure Key Vault makes it easy to rotate your keys without interruption to your applications. You can also manually rotate your keys.

Create an Azure Storage account.; 8 minutes to read; In this article. An Azure storage account contains all of your Azure Storage data objects: blobs, files, queues, tables, and disks. The storage account provides a unique namespace for your Azure Storage data that is accessible from anywhere in the world over HTTP or HTTPS. In this article we are going to see how to generate new Access Keys for an Azure Storage Account using the Windows Azure Management Portal. Overview: In our earlier articles we have seen the use of Access Keys and how to get the access keys from the Windows Azure Management Portal.

Protect your access keys

Your storage account access keys are similar to a root password for your storage account. Always be careful to protect your access keys. Use Azure Key Vault to manage and rotate your keys securely. Avoid distributing access keys to other users, hard-coding them, or saving them anywhere in plain text that is accessible to others. Rotate your keys if you believe they may have been compromised.

If possible, use Azure Active Directory (Azure AD) to authorize requests to Blob and Queue storage instead of Shared Key. Azure AD provides superior security and ease of use over Shared Key. For more information about authorizing access to data with Azure AD, see Authorize access to Azure blobs and queues using Azure Active Directory.

View access keys and connection string

To view and copy your storage account access keys or connection string from the Azure portal:

  1. Navigate to the Azure portal.

  2. Locate your storage account.

  3. Under Settings, select Access keys. Your account access keys appear, as well as the complete connection string for each key.

  4. Find the Key value under key1, and click the Copy button to copy the account key.

  5. Alternately, you can copy the entire connection string. Find the Connection string value under key1, and click the Copy button to copy the connection string.

You can use either key to access Azure Storage, but in general it's a good practice to use the first key, and reserve the use of the second key for when you are rotating keys.

To view or read an account's access keys, the user must either be a Service Administrator, or must be assigned an RBAC role that includes the Microsoft.Storage/storageAccounts/listkeys/action. Some built-in RBAC roles that include this action are the Owner, Contributor, and Storage Account Key Operator Service Role roles. For more information about the Service Administrator role, see Classic subscription administrator roles, Azure RBAC roles, and Azure AD roles. For detailed information about built-in roles for Azure Storage, see the Storage section in Azure built-in roles for Azure RBAC.

Use Azure Key Vault to manage your access keys

Microsoft recommends using Azure Key Vault to manage and rotate your access keys. Your application can securely access your keys in Key Vault, so that you can avoid storing them with your application code. For more information about using Key Vault for key management, see the following articles:

Manually rotate access keys

Microsoft recommends that you rotate your access keys periodically to help keep your storage account secure. If possible, use Azure Key Vault to manage your access keys. If you are not using Key Vault, you will need to rotate your keys manually.

Ms office 2010 home and business key generator. Two access keys are assigned so that you can rotate your keys. Having two keys ensures that your application maintains access to Azure Storage throughout the process.

Warning

Regenerating your access keys can affect any applications or Azure services that are dependent on the storage account key. Any clients that use the account key to access the storage account must be updated to use the new key, including media services, cloud, desktop and mobile applications, and graphical user interface applications for Azure Storage, such as Azure Storage Explorer.

Follow this process to rotate your storage account keys:

  1. Update the connection strings in your application code to use the secondary key.
  2. Regenerate the primary access key for your storage account. On the Access Keys blade in the Azure portal, click Regenerate Key1, and then click Yes to confirm that you want to generate a new key.
  3. Update the connection strings in your code to reference the new primary access key.
  4. Regenerate the secondary access key in the same manner.

Note

Azure Generate Storage Account Key Code

Microsoft recommends using only one of the keys in all of your applications at the same time. If you use Key 1 in some places and Key 2 in others, you will not be able to rotate your keys without some application losing access.

To rotate an account's access keys, the user must either be a Service Administrator, or must be assigned an RBAC role that includes the Microsoft.Storage/storageAccounts/regeneratekey/action. Some built-in RBAC roles that include this action are the Owner, Contributor, and Storage Account Key Operator Service Role roles. For more information about the Service Administrator role, see Classic subscription administrator roles, Azure RBAC roles, and Azure AD roles. For detailed information about built-in RBAC roles for Azure Storage, see the Storage section in Azure built-in roles for Azure RBAC.

Next steps

-->

Beginning with version 2015-04-05, Azure Storage supports creating a new type of shared access signature (SAS) at the level of the storage account. Creating an account SAS enables you to:

  • Delegate access to service-level operations that are not currently available with a service-specific SAS, such as the Get/Set Service Properties and Get Service Stats operations.

  • Delegate access to more than one service in a storage account at a time. For example, you can delegate access to resources in both the Blob and File services with an account SAS.

  • Delegate access to write and delete operations for containers, queues, tables, and file shares, which are not available with an object-specific SAS.

  • Specify an IP address or range of IP addresses from which to accept requests.

  • Specify the HTTP protocol from which to accept requests (either HTTPS or HTTP/HTTPS).

    It provides one serial key only once. That means, if you generate a fifa 13 serial key, it will not appear to anyone else again. Our key generator will give you fifa soccer 13 cd key, which will be absolutely unique. This makes those serials very legit. Fifa 13 cd key generator origin. This is one of the best features of our keygen.

Stored access policies are currently not supported for account SAS.

Caution

Shared access signature are keys that grant permissions to storage resources, and should be protected in the same manner as an account key. It's important to protect a SAS from malicious or unintended use. Use discretion in distributing a SAS, and have a plan in place for revoking a compromised SAS. Operations that use shared access signatures should be performed only over an HTTPS connection, and shared access signature URIs should only be distributed on a secure connection such as HTTPS.

Authorization of an account SAS

An account SAS is secured using the storage account key. To create an account SAS, a client application must possess the account key.

To use Azure AD credentials to secure a SAS for a container or blob, create a user delegation SAS. For more information, see Create a user delegation SAS.

Constructing the Account SAS URI

The account SAS URI consists of the URI to the resource for which the SAS will delegate access, followed by the SAS token. The SAS token is the query string that includes all of the information required to authorize a request to the resource, as well as to specify the service, resource, and permissions available for access, and the time interval over which the signature is valid.

Specifying Account SAS Parameters

The following table describes the required and optional parameters for the SAS token.

SAS Query ParameterDescription
api-versionOptional. Specifies the storage service version to use to execute the request made using the account SAS URI.
SignedVersion (sv)Required. Specifies the signed storage service version to use to authorize requests made with this account SAS. Must be set to version 2015-04-05 or later.
SignedServices (ss)Required. Specifies the signed services accessible with the account SAS. Possible values include:
- Blob (b)
- Queue (q)
- Table (t)
- File (f)
You can combine values to provide access to more than one service. For example, ss=bf specifies access to the Blob and File endpoints.
SignedResourceTypes (srt)Required. Specifies the signed resource types that are accessible with the account SAS.
- Service (s): Access to service-level APIs (e.g., Get/Set Service Properties, Get Service Stats, List Containers/Queues/Tables/Shares)
- Container (c): Access to container-level APIs (e.g., Create/Delete Container, Create/Delete Queue, Create/Delete Table, Create/Delete Share, List Blobs/Files and Directories)
- Object (o): Access to object-level APIs for blobs, queue messages, table entities, and files(e.g. Put Blob, Query Entity, Get Messages, Create File, etc.)
You can combine values to provide access to more than one resource type. For example, srt=sc specifies access to service and container resources.
SignedPermission (sp)Required. Specifies the signed permissions for the account SAS. Permissions are only valid if they match the specified signed resource type; otherwise they are ignored.
- Read (r): Valid for all signed resources types (Service, Container, and Object). Permits read permissions to the specified resource type.
- Write (w): Valid for all signed resources types (Service, Container, and Object). Permits write permissions to the specified resource type.
- Delete (d): Valid for Container and Object resource types, except for queue messages.
- List (l): Valid for Service and Container resource types only.
- Add (a): Valid for the following Object resource types only: queue messages, table entities, and append blobs.
- Create (c): Valid for the following Object resource types only: blobs and files. Users can create new blobs or files, but may not overwrite existing blobs or files.
- Update (u): Valid for the following Object resource types only: queue messages and table entities.
- Process (p): Valid for the following Object resource type only: queue messages.
SignedStart (st)Optional. The time at which the SAS becomes valid, in an ISO 8601 format. If omitted, start time for this call is assumed to be the time when the storage service receives the request.
SignedExpiry (se)Required. The time at which the shared access signature becomes invalid, in an ISO 8601 format.
SignedIP (sip)Optional. Specifies an IP address or a range of IP addresses from which to accept requests. When specifying a range, note that the range is inclusive.
For example, sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70.
SignedProtocol (spr)Optional. Specifies the protocol permitted for a request made with the account SAS. Possible values are both HTTPS and HTTP (https,http) or HTTPS only (https). The default value is https,http.
Note that HTTP only is not a permitted value.
Signature (sig)Required. The signature part of the URI is used to authorize the request made with the shared access signature.
The string-to-sign is a unique string constructed from the fields that must be verified in order to authorize the request. The signature is an HMAC computed over the string-to-sign and key using the SHA256 algorithm, and then encoded using Base64 encoding.

Specifying the signature validity interval

The SignedStart and SignedExpiry fields must be expressed as UTC times and must adhere to a valid ISO 8601 format. Supported ISO 8601 formats include the following:

  • YYYY-MM-DD

  • YYYY-MM-DDThh:mmTZD

  • YYYY-MM-DDThh:mm:ssTZD

For the date portion of these formats, YYYY is a four-digit year representation, MM is a two-digit month representation, and DD is a two-digit day representation. For the time portion, hh is the hour representation in 24-hour notation, mm is the two-digit minute representation, and ss is the two-digit second representation. A time designator T separates the date and time portions of the string, while a time zone designator TZD specifies the UTC time zone.

Constructing the signature string

To construct the signature string for an account SAS, first construct the string-to-sign from the fields comprising the request, then encode the string as UTF-8 and compute the signature using the HMAC-SHA256 algorithm. Note that fields included in the string-to-sign must be URL-decoded.

Azure Generate Storage Account Key Manager

To construct the string-to-sign for an account SAS, use the following format:

Account sas permissions by operation

The tables in the following sections list various APIs for each service and the signed resource types and signed permissions supported for each operation.

Blob service

The following table lists Blob service operations and indicates which signed resource type and signed permissions to specify to delegate access to those operations.

OperationSigned ServiceSigned Resource TypeSigned Permission
List ContainersBlob (b)Service (s)List (l)
Get Blob Service PropertiesBlob (b)Service (s)Read (r)
Set Blob Service PropertiesBlob (b)Service (s)Write (w)
Get Blob Service StatsBlob (b)Service (s)Read (r)
Create ContainerBlob (b)Container (c)Create(c) or Write (w)
Get Container PropertiesBlob (b)Container (c)Read (r)
Get Container MetadataBlob (b)Container (c)Read (r)
Set Container MetadataBlob (b)Container (c)Write (w)
Lease ContainerBlob (b)Container (c)Write (w) or Delete (d)1
Delete ContainerBlob (b)Container (c)Delete (d)
List BlobsBlob (b)Container (c)List (l)
Put Blob (create new block blob)Blob (b)Object (o)Create (c) or Write (w)
Put Blob (overwrite existing block blob)Blob (b)Object (o)Write (w)
Put Blob (create new page blob)Blob (b)Object (o)Create (c) or Write (w)
Put Blob (overwrite existing page blob)Blob (b)Object (o)Write (w)
Get BlobBlob (b)Object (o)Read (r)
Get Blob PropertiesBlob (b)Object (o)Read (r)
Set Blob PropertiesBlob (b)Object (o)Write (w)
Get Blob MetadataBlob (b)Object (o)Read (r)
Set Blob MetadataBlob (b)Object (o)Write (w)
Delete BlobBlob (b)Object (o)Delete (d)
Lease BlobBlob (b)Object (o)Write (w) or Delete (d)1
Snapshot BlobBlob (b)Object (o)Create (c) or Write (w)
Copy Blob (destination is new blob)Blob (b)Object (o)Create (c) or Write (w)
Copy Blob (destination is an existing blob)Blob (b)Object (o)Write (w)
Incremental CopyBlob (b)Object (o)Create (c) or Write (w)
Abort Copy BlobBlob (b)Object (o)Write (w)
Put BlockBlob (b)Object (o)Write (w)
Put Block List (create new blob)Blob (b)Object (o)Write (w)
Put Block List (update existing blob)Blob (b)Object (o)Write (w)
Get Block ListBlob (b)Object (o)Read (r)
Put PageBlob (b)Object (o)Write (w)
Get Page RangesBlob (b)Object (o)Read (r)
Append BlockBlob (b)Object (o)Add (a) or Write (w)
Clear PageBlob (b)Object (o)Write (w)

Note

The Delete permission allows breaking a lease on a blob or container with version 2017-07-29 and later.

Queue service

The following table lists Queue service operations and indicates which signed resource type and signed permissions to specify to delegate access to those operations.

OperationSigned ServiceSigned Resource TypeSigned Permission
Get Queue Service PropertiesQueue (q)Service (s)Read (r)
Set Queue Service PropertiesQueue (q)Service (s)Write (w)
List QueuesQueue (q)Service (s)List (l)
Get Queue Service StatsQueue (q)Service (s)Read (r)
Create QueueQueue (q)Container (c)Create(c) or Write (w)
Delete QueueQueue (q)Container (c)Delete (d)
Get Queue MetadataQueue (q)Container (c)Read (r)
Set Queue MetadataQueue (q)Container (c)Write (w)
Put MessageQueue (q)Object (o)Add (a)
Get MessagesQueue (q)Object (o)Process (p)
Peek MessagesQueue (q)Object (o)Read (r)
Delete MessageQueue (q)Object (o)Process (p)
Clear MessagesQueue (q)Object (o)Delete (d)
Update MessageQueue (q)Object (o)Update (u)

Table service

The following table lists Table service operations and indicates which signed resource type and signed permissions to specify to delegate access to those operations.

OperationSigned ServiceSigned Resource TypeSigned Permission
Get Table Service PropertiesTable (t)Service (s)Read (r)
Set Table Service PropertiesTable (t)Service (s)Write (w)
Get Table Service StatsTable (t)Service (s)Read (r)
Query TablesTable (t)Container (c)List (l)
Create TableTable (t)Container (c)Create (c) or Write (w)
Delete TableTable (t)Container (c)Delete (d)
Query EntitiesTable (t)Object (o)Read (r)
Insert EntityTable (t)Object (o)Add (a)
Insert Or Merge EntityTable (t)Object (o)Add (a) and Update (u)1
Insert Or Replace EntityTable (t)Object (o)Add (a) and Update (u)1
Update EntityTable (t)Object (o)Update (u)
Merge EntityTable (t)Object (o)Update (u)
Delete EntityTable (t)Object (o)Delete (d)

1Add and Update permissions are required for upsert operations on the Table Service.

File Service

Azure Blob Storage Account Key

The following table lists File service operations and indicates which signed resource type and signed permissions to specify to delegate access to those operations.

OperationSigned ServiceSigned Resource TypeSigned Permission
List SharesFile (f)Service (s)List (l)
Get File Service PropertiesFile (f)Service (s)Read (r)
Set File Service PropertiesFile (f)Service (s)Write (w)
Get Share StatsFile (f)Container (c)Read (r)
Create ShareFile (f)Container (c)Create (c) or Write (w)
Snapshot ShareFile (f)Container (c)Create (c) or Write (w)
Get Share PropertiesFile (f)Container (c)Read (r)
Set Share PropertiesFile (f)Container (c)Write (w)
Get Share MetadataFile (f)Container (c)Read (r)
Set Share MetadataFile (f)Container (c)Write (w)
Delete ShareFile (f)Container (c)Delete (d)
List Directories and FilesFile (f)Container (c)List (l)
Create DirectoryFile (f)Object (o)Create (c) or Write (w)
Get Directory PropertiesFile (f)Object (o)Read (r)
Get Directory MetadataFile (f)Object (o)Read (r)
Set Directory MetadataFile (f)Object (o)Write (w)
Delete DirectoryFile (f)Object (o)Delete (d)
Create File (create new)File (f)Object (o)Create (c) or Write (w)
Create File (overwrite existing)File (f)Object (o)Write (w)
Get FileFile (f)Object (o)Read (r)
Get File PropertiesFile (f)Object (o)Read (r)
Get File MetadataFile (f)Object (o)Read (r)
Set File MetadataFile (f)Object (o)Write (w)
Delete FileFile (f)Object (o)Delete (d)
Put RangeFile (f)Object (o)Write (w)
List RangesFile (f)Object (o)Read (r)
Abort Copy FileFile (f)Object (o)Write (w)
Copy FileFile (f)Object (o)Write (w)
Clear RangeFile (f)Object (o)Write (w)

Account SAS URI example

The following example shows an account SAS URI that provides read and write permissions to a blob. The table breaks down each part of the URI:

Azure Generate Storage Account Key Login

NameSAS portionDescription
Resource URIhttps://myaccount.blob.core.windows.net/?restype=service&comp=propertiesThe service endpoint, with parameters for getting service properties (when called with GET) or setting service properties (when called with SET). Based on the value of the signed services field (ss), this SAS can be used with either Blob storage or Azure Files.
Storage services versionsv=2019-02-02For storage services version 2012-02-12 and later, this parameter indicates the version to use.
Servicesss=bfThe SAS applies to the Blob and File services
Resource typessrt=sThe SAS applies to service-level operations.
Start timest=2019-08-01T22%3A18%3A26ZSpecified in UTC time. If you want the SAS to be valid immediately, omit the start time.
Expiry timese=2019-08-10T02%3A23%3A26ZSpecified in UTC time.
Permissionssp=rwThe permissions grant access to read and write operations.
IP rangesip=168.1.5.60-168.1.5.70The range of IP addresses from which a request will be accepted.
Protocolspr=httpsOnly requests using HTTPS are permitted.
Signaturesig=F%6GRVAZ5Cdj2Pw4tgU7IlSTkWgn7bUkkAg8P6HESXwmf%4BUsed to authorize access to the blob. The signature is an HMAC computed over a string-to-sign and key using the SHA256 algorithm, and then encoded using Base64 encoding.

Given that permissions are restricted to the service level, accessible operations with this SAS are Get Blob Service Properties (read) and Set Blob Service Properties (write). However, with a different resource URI, the same SAS token could also be used to delegate access to Get Blob Service Stats (read).

See also