Skip to content

Commit 8e4ef01

Browse files
Update instruction for pv2 creation (Azure CLI side)
1 parent 4af65cf commit 8e4ef01

File tree

1 file changed

+28
-122
lines changed

1 file changed

+28
-122
lines changed

articles/storage/files/storage-how-to-create-file-share.md

Lines changed: 28 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -229,34 +229,20 @@ $storageAccount = New-AzStorageAccount `
229229

230230
# [Azure CLI](#tab/azure-cli)
231231
### Create a provisioned v2 storage account (Azure CLI)
232-
The Azure CLI storage command group doesn't currently support creating provisioned v2 storage accounts. To create a provisioned v2 storage account using Azure CLI, use the `az resource create` command. Storage account properties can be set using the `--properties` parameter of the command. See [Microsoft.Storage resource provider REST API documentation](/rest/api/storagerp/storage-accounts/create#request-body) to learn more about the possible property names.
232+
To create a provisioned v2 storage account using Azure CLI, use the `az storage account create` command. This command has many options; only the required options are shown. To learn more about the advanced options, see the [`az storage account create` command documentation](/cli/azure/storage/account).
233233

234-
To create a storage account for provisioned v2 file shares, use the following command. Remember to replace the values for the variables `resourceGroupName`, `storageAccountName`, `region`, and `storageAccountSku` with the desired values for your storage account deployment.
234+
To create a storage account for provisioned v2 file shares, use the following command. Remember to replace the values for the variables `resourceGroupName`, `storageAccountName`, `region`, `storageAccountKind`, and `storageAccountSku` with the desired values for your storage account deployment.
235235

236236
```bash
237-
resourceGroupName="<my-resource-group>"
238-
storageAccountName="<my-storage-account-name>"
239-
region="<my-region>"
237+
$resourceGroupName="<my-resource-group>"
238+
$storageAccountName="<my-storage-account-name>"
239+
$region="<my-region>"
240+
$storageAccountKind="FileStorage"
240241

241-
# Valid SKUs are StandardV2_LRS (HDD Local provisioned v2), StandardV2_ZRS (HDD
242-
# Zone provisioned v2), StandardV2_GRS (HDD Geo provisioned v2),
243-
# StandardV2_GZRS (HDD GeoZone provisioned v2)
244-
storageAccountSku="StandardV2_LRS"
245-
246-
# Note that kind provided is FileStorage. Combining this with a valid selected
247-
# SKU will result in an HDD provisioned v2 file share with the selected
248-
# redundancy. It is also possible to other types of storage accounts with the
249-
# az resource create command, however, we recommend using the az storage account
250-
# create command instead.
251-
storageAccount=$(az resource create \
252-
--resource-type "Microsoft.Storage/storageAccounts" \
253-
--resource-group $resourceGroupName \
254-
--name $storageAccountName \
255-
--is-full-object \
256-
--properties "{\"location\":\"$region\",\"kind\":\"FileStorage\",\"sku\":{\"name\":\"$storageAccountSku\"},\"properties\":{}}" \
257-
--query "id" \
258-
--output tsv
259-
)
242+
# Valid SKUs for provisioned v2 HDD file share are 'StandardV2_LRS' (HDD Local Pv2), 'StandardV2_GRS' (HDD Geo Pv2), 'StandardV2_ZRS' (HDD Zone Pv2), 'StandardV2_GZRS' (HDD GeoZone Pv2).
243+
$storageAccountSku="StandardV2_LRS"
244+
245+
az storage account create --resource-group $resourceGroupName --name $storageAccountName --location $region --kind $storageAccountKind --sku $storageAccountSku --output none
260246
```
261247

262248
### Create a provisioned v1 or pay-as-you-go storage account (Azure CLI)
@@ -351,52 +337,23 @@ $f | fl
351337
```
352338

353339
# [Azure CLI](#tab/azure-cli)
354-
You can create an Azure file share with the `az resource create` command. The following commands assume you set the `storageAccount` variable when creating a storage account in the Azure CLI section.
340+
You can create an Provisioned v2 Azure file share with [`az storage share-rm create`](/cli/azure/storage/share-rm#az-storage-share-rm-create) command. The following PowerShell commands assume you set the variables `resourceGroupName` and `storageAccountName` as defined in the creating a storage account with Azure CLI section.
355341

356-
To create a provisioned v2 file share, use the following command. Remember to replace the values for the variables `shareName`, `provisionedStorageGib`, `provisionedIops`, and `provisionedThroughputMibPerSec` with the desired selections for your file share deployment.
342+
To create a provisioned v2 file share, use the following command. Remember to replace the values for the variables `shareName`, `provisionedStorageGib` with the desired selections for your file share deployment.
357343

358344
```bash
359-
shareName="<file-share>"
345+
$shareName="<file-share>"
360346

361-
# The provisioned storage size of the share in GiB. Valid range is 32 to
347+
# The provisioned storage size of the share in GiB. Valid range is 32 to
362348
# 262,144.
363-
provisionedStorageGib=1024
364-
365-
# The provisioned IOPS of the share. This is set to the empty string here to
366-
# get the recommended IOPS for the amount of provisioned storage provided,
367-
# however, you can override this value if you have detail about how many IOPS
368-
# your workload requires.
369-
provisionedIops=""
370-
371-
# The provisioned throughput in MiB / sec of the share. This is set to null
372-
# here to get the recommended throughput for the amount of provisioned storage
373-
# provided, however, you can override this value if you have detail about how
374-
# much throughput your workload requires.
375-
provisionedThroughputMibPerSec=""
376-
377-
# Build file share properties JSON.
378-
fileShareProperties="{\"shareQuota\":$provisionedStorageGib"
379-
380-
if [ ! -z "${provisionedIops}" ]; then
381-
fileShareProperties="$fileShareProperties,\"provisionedIops\":"
382-
fileShareProperties="$fileShareProperties$provisionedIops"
383-
fi
384-
385-
if [ ! -z "${provisionedThroughputMibPerSec}" ]; then
386-
fileShareProperties="$fileShareProperties,\"provisionedBandwidthMibps\":"
387-
fileShareProperties="$fileShareProperties$provisionedThroughputMibPerSec"
388-
fi
389-
390-
fileShareProperties="$fileShareProperties}"
349+
$provisionedStorageGib = 1024
391350

392-
# Build resource ID for desired file share
393-
resourceId="$storageAccount/fileServices/default/shares/$shareName"
351+
# If you do not specify on the ProvisionedBandwidthMibps and ProvisionedIops, the deployment will use the recommended provisioning.
352+
$provisionedIops = 3000
353+
$provisionedThroughputMibPerSec = 130
394354

395-
# Create resource
396-
az resource create \
397-
--id $resourceId \
398-
--properties $fileShareProperties \
399-
--output none
355+
az storage share-rm create --resource-group $resourceGroupName --name $shareName --storage-account $storageAccountName --quota $provisionedStorageGib
356+
# --provisioned-iops $provisionedIops --provisioned-bandwidth-mibps $provisionedThroughputMibPerSec
400357
```
401358

402359
---
@@ -598,74 +555,23 @@ $f | fl
598555
```
599556

600557
# [Azure CLI](#tab/azure-cli)
601-
You can modify a provisioned v2 file share with the `az resource patch` command. Remember to replace the value of variables `resourceGroupName`, `storageAccountName`, `fileShareName`, `provisionedStorageGib`, `provisionedIops`, and `provisionedThroughputMibPerSec` with the correct values for your file share.
558+
You can modify a provisioned v2 file share with the `az storage share-rm update` command. Remember to replace the values for the variables `resourceGroupName`, `storageAccountName`, `fileShareName`, `provisionedStorageGib`, `provisionedIops`, and `provisionedThroughputMibPerSec` with the desired values for your file share.
602559

603560
```bash
604561
# The path to the file share resource to be modified.
605562
resourceGroupName="<resource-group>"
606563
storageAccountName="<storage-account>"
607564
fileShareName="<file-share>"
608565

609-
# The provisioning desired on the file share. Set these values to the empty
610-
# string if no change is desired.
611-
provisionedStorageGib=10240
612-
provisionedIops=10000
613-
provisionedThroughputMibPerSec=2048
614-
615-
# Get the resource ID of the storage account
616-
storageAccount=$(az resource show \
617-
--resource-type "Microsoft.Storage/storageAccounts" \
618-
--resource-group $resourceGroupName \
619-
--name $storageAccountName \
620-
--query "id" \
621-
--output tsv
622-
)
623-
624-
# Build the resource ID of the file share
625-
resourceId="$storageAccount/fileServices/default/shares/$fileShareName"
626-
627-
# Build the properties to be updated for the file share
628-
fileShareProperties="{"
629-
630-
if [ -z "${provisionedStorageGib}" ]; then
631-
provisionedStorageGib=$(az resource show \
632-
--ids $resourceId \
633-
--query "properties.shareQuota" \
634-
--output tsv
635-
)
636-
fi
637-
638-
fileShareProperties="$fileShareProperties\"shareQuota\":"
639-
fileShareProperties="$fileShareProperties$provisionedStorageGib"
640-
641-
if [ -z "${provisionedIops}" ]; then
642-
provisionedIops=$(az resource show \
643-
--ids $resourceId \
644-
--query "properties.provisionedIops" \
645-
--output tsv
646-
)
647-
fi
648-
649-
fileShareProperties="$fileShareProperties,\"provisionedIops\":"
650-
fileShareProperties="$fileShareProperties$provisionedIops"
651-
652-
if [ -z "${provisionedThroughputMibPerSec}" ]; then
653-
provisionedThroughputMibPerSec=$(az resource show \
654-
--ids $resourceId \
655-
--query "properties.provisionedBandwidthMibps" \
656-
--output tsv
657-
)
658-
fi
659-
660-
fileShareProperties="$fileShareProperties,\"provisionedBandwidthMibps\":"
661-
fileShareProperties="$fileShareProperties$provisionedThroughputMibPerSec"
566+
# The provisioning desired on the file share. Delete the parameters if no
567+
# change is desired.
568+
$provisionedStorageGib = 10240
569+
$provisionedIops = 10000
570+
$provisionedThroughputMibPerSec = 2048
662571

663-
fileShareProperties="$fileShareProperties}"
572+
# Update the file share provisioning.
573+
az storage share-rm update --resource-group $resourceGroupName --name $shareName --storage-account $storageAccountName --quota $provisionedStorageGib --provisioned-iops $provisionedIops --provisioned-bandwidth-mibps $provisionedThroughputMibPerSec
664574

665-
# Update file share with new provisioning
666-
az resource patch \
667-
--ids $resourceId \
668-
--properties $fileShareProperties
669575
```
670576

671577
---

0 commit comments

Comments
 (0)