Skip to content

Commit 04a1eb3

Browse files
Changed Pv2 File Shares PowerShell Instructions
1 parent 3a0060d commit 04a1eb3

File tree

1 file changed

+41
-97
lines changed

1 file changed

+41
-97
lines changed

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

Lines changed: 41 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -162,33 +162,24 @@ The final step to create the storage account is to select the **Create** button
162162

163163
# [PowerShell](#tab/azure-powershell)
164164
### Create a provisioned v2 storage account (PowerShell)
165-
The Az.Storage PowerShell module doesn't currently support creating provisioned v2 storage accounts. To create a provisioned v2 storage account using PowerShell, use the `New-AzResource` cmdlet. Storage account properties can be set using the `-Properties` parameter of the `New-AzResource` cmdlet. See [Microsoft.Storage resource provider REST API documentation](/rest/api/storagerp/storage-accounts/create#request-body) to learn more about the possible property names.
165+
To create a provisioned v2 storage account using PowerShell, use the `New-AzStorageAccount` cmdlet in the Az.Storage PowerShell module. This cmdlet has many options; only the required options are shown. To learn more about advanced options, see the [`New-AzStorageAccount` cmdlet documentation](/powershell/module/az.storage/new-azstorageaccount).
166166

167-
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.
167+
To create a storage account for provisioned v2 file shares, use the following command. Remember to replace the values for the variables `$resourceGroup`, `$accountName`, `$region`, and `$storageAccountSku` with the desired values for your storage account deployment.
168168

169169
```PowerShell
170-
$resourceGroupName = "<my-resource-group>"
171-
$storageAccountName = "<my-storage-account-name>"
170+
$resourceGroup = "<my-resource-group>"
171+
$accountName = "<my-storage-account-name>"
172172
$region = "<my-region>"
173-
174-
# Valid SKUs are StandardV2_LRS (HDD Local provisioned v2), StandardV2_ZRS (HDD
175-
# Zone provisioned v2), StandardV2_GRS (HDD Geo provisioned v2),
176-
# StandardV2_GZRS (HDD GeoZone provisioned v2)
173+
$storageAccountKind = "FileStorage"
174+
# Valid SKUs for provision v2 HDD file share are 'StandardV2_LRS' (HDD Local Pv2),
175+
# 'StandardV2_GRS' (HDD Geo Pv2), 'StandardV2_ZRS' (HDD Zone Pv2), 'StandardV2_GZRS (HDD GeoZone Pv2)'
177176
$storageAccountSku = "StandardV2_LRS"
178177
179-
# Note that kind provided is FileStorage. Combining this with a valid selected
180-
# SKU will result in an HDD provisioned v2 file share with the selected
181-
# redundancy. It is also possible to other types of storage accounts with the
182-
# New-AzResource cmdlet, however, we recommend using the New-AzStorageAccount
183-
# cmdlet instead.
184-
$storageAccount = New-AzResource `
185-
-ResourceType "Microsoft.Storage/storageAccounts" `
186-
-ResourceGroupName $resourceGroupName `
187-
-ResourceName $storageAccountName `
188-
-Location $region `
189-
-Kind "FileStorage" `
190-
-Sku @{ Name = $storageAccountSku } `
191-
-Confirm:$false
178+
New-AzStorageAccount -ResourceGroupName $resourceGroup `
179+
-AccountName $accountName `
180+
-SkuName $storageAccountSku `
181+
-Kind $storageAccountKind `
182+
-Location $region
192183
```
193184

194185
### Create a provisioned v1 or pay-as-you-go storage account (PowerShell)
@@ -325,52 +316,29 @@ Follow these instructions to create a new Azure file share using the Azure porta
325316
5. Select **Review + create** and then **Create** to create the Azure file share.
326317

327318
# [PowerShell](#tab/azure-powershell)
328-
You can create an Azure file share with the `New-AzResource` cmdlet. The following PowerShell commands assume you set the `$storageAccount` variable when creating a storage account in the Azure PowerShell section.
319+
You can create a provisioned v2 Azure file share with the `New-AzRmStorageShare` cmdlet. The following PowerShell commands assume you set the variables `$resourceGroup` and `$accountName` as defined in the "Create Storage Account" section.
329320

330-
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.
321+
To create a provisioned v2 file share, use the following command. Remember to replace the values for the variables `$shareName` and `$provisionedStorageGib` with the desired selections for your file share deployment.
331322

332323
```powershell
333-
$shareName = "<file-share>"
324+
$shareName = "<name-of-the-file-share>"
334325
335-
# The provisioned storage size of the share in GiB. Valid range is 32 to
336-
# 262,144.
326+
# The provisioned storage size of the share in GiB. Valid range is 32 to 262,144.
337327
$provisionedStorageGib = 1024
338328
339-
# The provisioned IOPS of the share. This is set to null here to get the
340-
# recommended IOPS for the amount of provisioned storage provided, however, you
341-
# can override this value if you have detail about how many IOPS your workload
342-
# requires.
343-
$provisionedIops = $null
344-
345-
# The provisioned throughput in MiB / sec of the share. This is set to null
346-
# here to get the recommended throughput for the amount of provisioned storage
347-
# provided, however, you can override this value if you have detail about how
348-
# much throughput your workload requires.
349-
$provisionedThroughputMibPerSec = $null
350-
351-
# Build file share properties for provisioning
352-
$fileShareProperties = @{ shareQuota = $provisionedStorageGib }
353-
354-
if ($null -ne $provisionedIops) {
355-
$fileShareProperties += @{ provisionedIops = $provisionedIops }
356-
}
357-
358-
if ($null -ne $provisionedThroughputMibPerSec) {
359-
$fileShareProperties += @{
360-
provisionedBandwidthMibps = $provisionedThroughputMibPerSec
361-
}
362-
}
329+
# If you do not specify on the ProvisionedBandwidthMibps and ProvisionedIops,
330+
# the deployment will use the recommended provisioning.
331+
$provisionedIops = 3000
332+
$provisionedThroughputMibPerSec = 130
363333
364-
# Build resource ID for desired file share
365-
$resourceId = $storageAccount.ResourceId
366-
$resourceId += "/fileServices/default/shares/$shareName"
334+
New-AzRmStorageShare -ResourceGroupName $resourceGroup `
335+
-AccountName $accountName `
336+
-ShareName $shareName `
337+
-QuotaGiB $provisionedStorageGib;
367338
368-
# Create resource
369-
New-AzResource `
370-
-ResourceId $resourceId `
371-
-Properties $fileShareProperties `
372-
-Confirm:$false | `
373-
Out-Null
339+
# -ProvisionedBandwidthMibps $provisionedThroughputMibPerSec -ProvisionedIops $provisionedIops
340+
$f = Get-AzRmStorageShare -ResourceGroupName $resourceGroup -AccountName $accountName -ShareName $shareName;
341+
$f | fl
374342
```
375343

376344
# [Azure CLI](#tab/azure-cli)
@@ -600,52 +568,28 @@ Follow these instructions to update the provisioning for your file share.
600568
5. Select **Save** to save provisioning changes. Storage, IOPS, and throughput changes are effective within a few minutes after a provisioning change.
601569

602570
# [PowerShell](#tab/azure-powershell)
603-
You can modify a provisioned v2 file share with the `Set-AzResource` cmdlet. Remember to replace the values for the variables `$resourceGroupName`, `$storageAccountName`, `$fileShareName`, `$provisionedStorageGib`, `$provisionedIops`, and `$provisionedThroughputMibPerSec` with the desired values for your file share.
571+
You can modify a provisioned v2 file share with the `Update-AzRmStorageShare` cmdlet. Remember to replace the values for the variables `$resourceGroup`, `$accountName`, `$shareName`, `$provisionedMibps`, `$provisionedIops`, and `$provisionedStorageGib` with the desired values for your file share.
604572

605573
```powershell
606574
# The path to the file share resource to be modified.
607-
$resourceGroupName = "<resource-group>"
608-
$storageAccountName = "<storage-account>"
609-
$fileShareName = "<file-share>"
575+
$resourceGroup = "<my-resource-group>"
576+
$accountName = "<my-storage-account-name>"
577+
$shareName = "<name-of-the-file-share>"
610578
611-
# The provisioning desired on the file share. Set these values to $null if no
612-
# change is desired.
579+
# The provisioning desired on the file share. Delete the parameters if no change is desired.
613580
$provisionedStorageGib = 10240
614581
$provisionedIops = 10000
615582
$provisionedThroughputMibPerSec = 2048
616583
617-
# Get the resource ID of the storage account
618-
$storageAccount = Get-AzResource `
619-
-ResourceType "Microsoft.Storage/storageAccounts" `
620-
-ResourceGroupName $resourceGroupName `
621-
-ResourceName $storageAccountName
622-
623-
# Build the resource ID of the file share
624-
$resourceId = $storageAccount.ResourceId
625-
$resourceId += "/fileServices/default/shares/$fileShareName"
626-
627-
# Build the properties to be updated for the file share
628-
$fileShareProperties = @{}
629-
630-
if ($null -ne $provisionedStorageGib) {
631-
$fileShareProperties += @{ shareQuota = $provisionedStorageGib }
632-
}
633-
634-
if ($null -ne $provisionedIops) {
635-
$fileShareProperties += @{ provisionedIops = $provisionedIops }
636-
}
637-
638-
if ($null -ne $provisionedThroughputMibPerSec) {
639-
$fileShareProperties += @{
640-
provisionedBandwidthMibps = $provisionedThroughputMibPerSec
641-
}
642-
}
643-
644-
# Update file share with new provisioning
645-
Set-AzResource `
646-
-ResourceId $resourceId `
647-
-Properties $fileShareProperties `
648-
-Confirm:$false
584+
# Update the file share provisioning.
585+
Update-AzRmStorageShare -ResourceGroupName $resourceGroup `
586+
-AccountName $accountName `
587+
-ShareName $shareName `
588+
-ProvisionedBandwidthMibps $provisionedThroughputMibPerSec `
589+
-ProvisionedIops $provisionedIops `
590+
-QuotaGiB $provisionedStorageGib;
591+
$f = Get-AzRmStorageShare -ResourceGroupName $resourceGroup -AccountName $accountName -ShareName $shareName;
592+
$f | fl
649593
```
650594

651595
# [Azure CLI](#tab/azure-cli)

0 commit comments

Comments
 (0)