Skip to main content

file_shares

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

Overview

Namefile_shares
TypeResource
Idazure.storage.file_shares

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
accessTierstringAccess tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium. Known values are: "TransactionOptimized", "Hot", "Cool", and "Premium". (TransactionOptimized, Hot, Cool, Premium)
accessTierChangeTimestring (date-time)Indicates the last modification time for share access tier.
accessTierStatusstringIndicates if there is a pending transition for access tier.
deletedbooleanIndicates whether the share was deleted.
deletedTimestring (date-time)The deleted time if the share was deleted.
enabledProtocolsstringThe authentication protocol that is used for the file share. Can only be specified when creating a share. Known values are: "SMB" and "NFS". (SMB, NFS)
etagstringResource Etag.
fileSharePaidBurstingobjectFile Share Paid Bursting properties.
includedBurstIopsintegerThe calculated burst IOPS of the share. This property is only for file shares created under Files Provisioned v2 account type.
lastModifiedTimestring (date-time)Returns the date and time the share was last modified.
leaseDurationstringSpecifies whether the lease on a share is of infinite or fixed duration, only when the share is leased. Known values are: "Infinite" and "Fixed". (Infinite, Fixed)
leaseStatestringLease state of the share. Known values are: "Available", "Leased", "Expired", "Breaking", and "Broken". (Available, Leased, Expired, Breaking, Broken)
leaseStatusstringThe lease status of the share. Known values are: "Locked" and "Unlocked". (Locked, Unlocked)
maxBurstCreditsForIopsintegerThe calculated maximum burst credits for the share. This property is only for file shares created under Files Provisioned v2 account type.
metadataobjectA name-value pair to associate with the share as metadata.
nextAllowedProvisionedBandwidthDowngradeTimestring (date-time)Returns the next allowed provisioned bandwidth downgrade time for the share. This property is only for file shares created under Files Provisioned v2 account type.
nextAllowedProvisionedIopsDowngradeTimestring (date-time)Returns the next allowed provisioned IOPS downgrade time for the share. This property is only for file shares created under Files Provisioned v2 account type.
nextAllowedQuotaDowngradeTimestring (date-time)Returns the next allowed provisioned storage size downgrade time for the share. This property is only for file shares created under Files Provisioned v1 SSD and Files Provisioned v2 account type.
provisionedBandwidthMibpsintegerThe provisioned bandwidth of the share, in mebibytes per second. This property is only for file shares created under Files Provisioned v2 account type. Please refer to the GetFileServiceUsage API response for the minimum and maximum allowed value for provisioned bandwidth.
provisionedIopsintegerThe provisioned IOPS of the share. This property is only for file shares created under Files Provisioned v2 account type. Please refer to the GetFileServiceUsage API response for the minimum and maximum allowed value for provisioned IOPS.
remainingRetentionDaysintegerRemaining retention days for share that was soft deleted.
rootSquashstringThe property is for NFS share only. The default is NoRootSquash. Known values are: "NoRootSquash", "RootSquash", and "AllSquash". (NoRootSquash, RootSquash, AllSquash)
shareQuotaintegerThe provisioned size of the share, in gibibytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. For file shares created under Files Provisioned v2 account type, please refer to the GetFileServiceUsage API response for the minimum and maximum allowed provisioned storage size.
shareUsageBytesintegerThe approximate size of the data stored on the share. Note that this value may not include all recently created or recently resized files.
signedIdentifiersarrayList of stored access policies specified on the share.
snapshotTimestring (date-time)Creation time of share snapshot returned in the response of list shares with expand param "snapshots".
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
versionstringThe version of the share.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, account_name, share_name, subscription_id$expand, x-ms-snapshotGets properties of a specified share.
listselectresource_group_name, account_name, subscription_id$maxpagesize, $filter, $expandLists all shares.
createinsertresource_group_name, account_name, share_name, subscription_id$expandCreates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
updateupdateresource_group_name, account_name, share_name, subscription_idUpdates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist.
deletedeleteresource_group_name, account_name, share_name, subscription_idx-ms-snapshot, $includeDeletes specified share under its account.
restoreexecresource_group_name, account_name, share_name, subscription_id, deletedShareName, deletedShareVersionRestore a file share within a valid retention days if share soft delete is enabled.
leaseexecresource_group_name, account_name, share_name, subscription_id, actionx-ms-snapshotThe Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.

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.
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
share_namestringThe name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.
subscription_idstring
$expandstringOptional, used to expand the properties within share's properties. Valid values are: snapshots. Should be passed as a string with delimiter ','. Default value is None.
$filterstringOptional. When specified, only share names starting with the filter will be listed. Default value is None.
$includestringOptional. Valid values are: snapshots, leased-snapshots, none. The default value is snapshots. For 'snapshots', the file share is deleted including all of its file share snapshots. If the file share contains leased-snapshots, the deletion fails. For 'leased-snapshots', the file share is deleted included all of its file share snapshots (leased/unleased). For 'none', the file share is deleted if it has no share snapshots. If the file share contains any snapshots (leased or unleased), the deletion fails. Default value is None.
$maxpagesizestring
x-ms-snapshotstringOptional. Specify the snapshot time to lease a snapshot. Default value is None.

SELECT examples

Gets properties of a specified share.

SELECT
id,
name,
accessTier,
accessTierChangeTime,
accessTierStatus,
deleted,
deletedTime,
enabledProtocols,
etag,
fileSharePaidBursting,
includedBurstIops,
lastModifiedTime,
leaseDuration,
leaseState,
leaseStatus,
maxBurstCreditsForIops,
metadata,
nextAllowedProvisionedBandwidthDowngradeTime,
nextAllowedProvisionedIopsDowngradeTime,
nextAllowedQuotaDowngradeTime,
provisionedBandwidthMibps,
provisionedIops,
remainingRetentionDays,
rootSquash,
shareQuota,
shareUsageBytes,
signedIdentifiers,
snapshotTime,
systemData,
type,
version
FROM azure.storage.file_shares
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND account_name = '{{ account_name }}' -- required
AND share_name = '{{ share_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
AND x-ms-snapshot = '{{ x-ms-snapshot }}'
;

INSERT examples

Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.

INSERT INTO azure.storage.file_shares (
properties,
resource_group_name,
account_name,
share_name,
subscription_id,
$expand
)
SELECT
'{{ properties }}',
'{{ resource_group_name }}',
'{{ account_name }}',
'{{ share_name }}',
'{{ subscription_id }}',
'{{ $expand }}'
RETURNING
id,
name,
etag,
properties,
systemData,
type
;

UPDATE examples

Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist.

UPDATE azure.storage.file_shares
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND account_name = '{{ account_name }}' --required
AND share_name = '{{ share_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
properties,
systemData,
type;

DELETE examples

Deletes specified share under its account.

DELETE FROM azure.storage.file_shares
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND account_name = '{{ account_name }}' --required
AND share_name = '{{ share_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND x-ms-snapshot = '{{ x-ms-snapshot }}'
AND $include = '{{ $include }}'
;

Lifecycle Methods

Restore a file share within a valid retention days if share soft delete is enabled.

EXEC azure.storage.file_shares.restore 
@resource_group_name='{{ resource_group_name }}' --required,
@account_name='{{ account_name }}' --required,
@share_name='{{ share_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"deletedShareName": "{{ deletedShareName }}",
"deletedShareVersion": "{{ deletedShareVersion }}"
}'
;