Skip to main content

accounts

Creates, updates, deletes, gets or lists an accounts resource.

Overview

Nameaccounts
TypeResource
Idazure.storage.accounts

Fields

The following fields are returned by SELECT queries:

OK -- List of storage accounts in the given resource group retrieved and returned successfully.

NameDatatypeDescription
extendedLocationobjectThe extendedLocation of the resource.
identityobjectThe identity of the resource.
kindstringGets the Kind.
locationstringThe geo-location where the resource lives
propertiesobjectProperties of the storage account.
skuobjectGets the SKU.
tagsobjectResource tags.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_by_resource_groupselectresourceGroupName, subscriptionIdLists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this.
listselectsubscriptionIdLists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this.
createinsertresourceGroupName, accountName, subscriptionId, data__sku, data__kind, data__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.
updateupdateresourceGroupName, accountName, subscriptionIdThe 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.
deletedeleteresourceGroupName, accountName, subscriptionIdDeletes a storage account in Microsoft Azure.
check_name_availabilityexecsubscriptionId, name, typeChecks that the storage account name is valid and is not already in use.
regenerate_keyexecresourceGroupName, accountName, subscriptionId, keyNameRegenerates one of the access keys or Kerberos keys for the specified storage account.
failoverexecresourceGroupName, accountName, subscriptionIdfailoverTypeA 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/en-us/azure/storage/common/storage-disaster-recovery-guidance
hierarchical_namespace_migrationexecresourceGroupName, accountName, subscriptionId, requestTypeLive Migration of storage account to enable Hns
abort_hierarchical_namespace_migrationexecresourceGroupName, accountName, subscriptionIdAbort live Migration of storage account to enable Hns
customer_initiated_migrationexecresourceGroupName, accountName, subscriptionId, 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_rangesexecresourceGroupName, accountName, subscriptionId, timeToRestore, blobRangesRestore blobs in the specified blob ranges
revoke_user_delegation_keysexecresourceGroupName, accountName, subscriptionIdRevoke 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
accountNamestringThe 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.
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.
resourceGroupNamestringThe name of the resource group within the user's subscription. The name is case insensitive.
subscriptionIdstring (uuid)The ID of the target subscription. The value must be an UUID.
failoverTypestringThe parameter is set to 'Planned' to indicate whether a Planned failover is requested.

SELECT examples

Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this.

SELECT
extendedLocation,
identity,
kind,
location,
properties,
sku,
tags
FROM azure.storage.accounts
WHERE resourceGroupName = '{{ resourceGroupName }}' -- required
AND subscriptionId = '{{ subscriptionId }}' -- 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.accounts (
data__sku,
data__kind,
data__location,
data__extendedLocation,
data__tags,
data__identity,
data__properties,
resourceGroupName,
accountName,
subscriptionId
)
SELECT
'{{ sku }}' /* required */,
'{{ kind }}' /* required */,
'{{ location }}' /* required */,
'{{ extendedLocation }}',
'{{ tags }}',
'{{ identity }}',
'{{ properties }}',
'{{ resourceGroupName }}',
'{{ accountName }}',
'{{ subscriptionId }}'
RETURNING
extendedLocation,
identity,
kind,
location,
properties,
sku,
tags
;

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.accounts
SET
data__sku = '{{ sku }}',
data__tags = '{{ tags }}',
data__identity = '{{ identity }}',
data__properties = '{{ properties }}',
data__kind = '{{ kind }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}' --required
AND accountName = '{{ accountName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
RETURNING
extendedLocation,
identity,
kind,
location,
properties,
sku,
tags;

DELETE examples

Deletes a storage account in Microsoft Azure.

DELETE FROM azure.storage.accounts
WHERE resourceGroupName = '{{ resourceGroupName }}' --required
AND accountName = '{{ accountName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
;

Lifecycle Methods

Checks that the storage account name is valid and is not already in use.

EXEC azure.storage.accounts.check_name_availability 
@subscriptionId='{{ subscriptionId }}' --required
@@json=
'{
"name": "{{ name }}",
"type": "{{ type }}"
}'
;