Skip to main content

storage_accounts

Creates, updates, deletes, gets or lists a storage_accounts resource.

Overview

Namestorage_accounts
TypeResource
Idazure.storage.storage_accounts

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
accountSasTokenstringList SAS credentials of storage account.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_account_sasselectresource_group_name, account_name, subscription_idList SAS credentials of a storage account.
list_service_sasselectresource_group_name, account_name, subscription_idList service SAS credentials of a specific resource.
get_customer_initiated_migrationselectresource_group_name, account_name, migration_name, subscription_idGets the status of the ongoing migration for the specified storage account.
list_keysselectresource_group_name, account_name, subscription_id$expandLists the access keys or Kerberos keys (if active directory enabled) for the specified storage account.
check_name_availabilityselectsubscription_idChecks that the storage account name is valid and is not already in use.
list_by_resource_groupselectresource_group_name, subscription_idLists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this.
listselectsubscription_idLists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this.
createinsertresource_group_name, account_name, subscription_id, sku, kind, locationAsynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed.
updateupdateresource_group_name, account_name, subscription_idThe update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
deletedeleteresource_group_name, account_name, subscription_idDeletes a storage account in Microsoft Azure.
get_propertiesexecresource_group_name, account_name, subscription_id$expandReturns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys.
regenerate_keyexecresource_group_name, account_name, subscription_id, keyNameRegenerates one of the access keys or Kerberos keys for the specified storage account.
failoverexecresource_group_name, account_name, subscription_idfailoverTypeA failover request can be triggered for a storage account in the event a primary endpoint becomes unavailable for any reason. The failover occurs from the storage account's primary cluster to the secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover and the account is converted to LRS. In the case of a Planned Failover, the primary and secondary clusters are swapped after failover and the account remains geo-replicated. Failover should continue to be used in the event of availability issues as Planned failover is only available while the primary and secondary endpoints are available. The primary use case of a Planned Failover is disaster recovery testing drills. This type of failover is invoked by setting FailoverType parameter to 'Planned'. Learn more about the failover options here- https://learn.microsoft.com/azure/storage/common/storage-disaster-recovery-guidance _.
hierarchical_namespace_migrationexecresource_group_name, account_name, subscription_id, requestTypeLive Migration of storage account to enable Hns.
abort_hierarchical_namespace_migrationexecresource_group_name, account_name, subscription_idAbort live Migration of storage account to enable Hns.
customer_initiated_migrationexecresource_group_name, account_name, subscription_id, propertiesAccount Migration request can be triggered for a storage account to change its redundancy level. The migration updates the non-zonal redundant storage account to a zonal redundant account or vice-versa in order to have better reliability and availability. Zone-redundant storage (ZRS) replicates your storage account synchronously across three Azure availability zones in the primary region.
restore_blob_rangesexecresource_group_name, account_name, subscription_id, timeToRestore, blobRangesRestore blobs in the specified blob ranges.
revoke_user_delegation_keysexecresource_group_name, account_name, subscription_idRevoke user delegation keys.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_namestringThe name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.
migration_namestringThe name of the Storage Account Migration. It should always be 'default'. "default" Required.
requestTypestringRequired. Hierarchical namespace migration type can either be a hierarchical namespace validation request 'HnsOnValidationRequest' or a hydration request 'HnsOnHydrationRequest'. The validation request will validate the migration whereas the hydration request will migrate the account. Required.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
subscription_idstring
$expandstringMay be used to expand the properties within account's properties. By default, data is not included when fetching properties. Currently we only support geoReplicationStats and blobRestoreStatus. Known values are: "geoReplicationStats" and "blobRestoreStatus". Default value is None.
failoverTypestringThe parameter is set to 'Planned' to indicate whether a Planned failover is requested. Known values are "Planned" and None. Default value is "Planned".

SELECT examples

List SAS credentials of a storage account.

SELECT
accountSasToken
FROM azure.storage.storage_accounts
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND account_name = '{{ account_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed.

INSERT INTO azure.storage.storage_accounts (
sku,
kind,
location,
extendedLocation,
zones,
placement,
tags,
identity,
properties,
resource_group_name,
account_name,
subscription_id
)
SELECT
'{{ sku }}' /* required */,
'{{ kind }}' /* required */,
'{{ location }}' /* required */,
'{{ extendedLocation }}',
'{{ zones }}',
'{{ placement }}',
'{{ tags }}',
'{{ identity }}',
'{{ properties }}',
'{{ resource_group_name }}',
'{{ account_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
extendedLocation,
identity,
kind,
location,
placement,
properties,
sku,
systemData,
tags,
type,
zones
;

UPDATE examples

The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.

UPDATE azure.storage.storage_accounts
SET
sku = '{{ sku }}',
tags = '{{ tags }}',
identity = '{{ identity }}',
properties = '{{ properties }}',
kind = '{{ kind }}',
zones = '{{ zones }}',
placement = '{{ placement }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND account_name = '{{ account_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
extendedLocation,
identity,
kind,
location,
placement,
properties,
sku,
systemData,
tags,
type,
zones;

DELETE examples

Deletes a storage account in Microsoft Azure.

DELETE FROM azure.storage.storage_accounts
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND account_name = '{{ account_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys.

EXEC azure.storage.storage_accounts.get_properties 
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@subscription_id='{{ subscription_id }}' --required,
@$expand='{{ $expand }}'
;