$shareName = "<file-share>"
# The provisioned storage size of the share in GiB. Valid range is 100 to
# 102,400.
$provisionedStorageGib = 1024
# The protocol chosen for the file share. Valid set contains "SMB" and "NFS".
$protocol = "SMB"
New-AzRmStorageShare `
-ResourceGroupName $resourceGroupName `
-StorageAccountName $storageAccountName `
-Name $shareName `
-QuotaGiB $provisionedStorageGib `
-EnabledProtocol $protocol | `
Out-Null
shareName="<file-share>"
# The provisioned storage size of the share in GiB. Valid range is 100 to
# 102,400.
provisionedStorageGib=1024
# The protocol chosen for the file share. Valid set contains "SMB" and "NFS".
protocol="SMB"
az storage share-rm create \
--resource-group $resourceGroupName \
--storage-account $storageAccountName \
--name $shareName \
--quota $provisionedStorageGib \
--enabled-protocols $protocol \
--output none
# The path to the file share resource to be modified.
resourceGroupName="<resource-group>"
storageAccountName="<storage-account>"
fileShareName="<file-share>"
# The provisioning desired on the file share.
provisionedStorageGib=10240
# Update the file share provisioning.
az storage share-rm update \
--resource-group $resourceGroupName \
--storage-account $storageAccountName \
--name $fileShareName \
--quota $provisionedStorageGib
# The path to the file share resource to be modified.
resourceGroupName="<resource-group>"
storageAccountName="<storage-account>"
fileShareName="<file-share>"
# The settings to be changed on the file share. Set to the empty string to skip
# setting.
accessTier="Cool"
quotaGib=""
command="az storage share-rm update --resource-group $resourceGroupName"
command="$command --storage-account $storageAccountName --name $fileShareName"
if [ ! -z "${accessTier}" ]; then
command="$command --access-tier $accessTier"
fi
if [ ! -z "${quotaGib}" ]; then
command="$command --quota $quotaGib"
fi
# Update file share (command is in variable)
$command
# Login to Azure account
Connect-AzAccount -Environment AzureChinaCloud
# Track down the subscription ID in GUID format
$subscriptionID = "your-subscription-id-number"
# Get Token
$token = Get-AzAccessToken
# Invoke SRP list SKU API, and get the returned SKU list
$result = Invoke-RestMethod -Method Get -Uri "https://management.chinacloudapi.cn/subscriptions/$($subscriptionID)/providers/Microsoft.Storage/skus?api-version=2024-01-01" -Headers @{"Authorization" = "Bearer $($token.Token)"}
# Filter the SKU list to get the required information, customization requried here to get the best result.
$filteredResult = $result | `
Select-Object -ExpandProperty value | `
Where-Object {
$_.resourceType -eq "storageAccounts" -and
# Filter based on your needs. FileStorage kind includes pv2, and pv1 file share, where StorageV2 kind include PayGO file shares.
$_.kind -in @("FileStorage", "StorageV2") -and
# Filter based on your needs. "Standard_" for PayGO file share, "StandardV2_" for Pv2 file share, "Premium_" for pv1 file shares.
# $_.name.StartsWith("StandardV2_") -and
# Change region based on your need to see if we currently support the region (all small cases, no space in between).
# $_.locations -eq "italynorth" -and
$_.name -notin @("Standard_RAGRS", "Standard_RAGZRS")
}
if ($filteredResult.Count -eq 0) {
Write-Output "No results found."
} else {
$filteredResult | `
Select-Object `
-Property `
@{
Name = "sku";
Expression = { $_.name }
}, `
kind, `
@{
Name = "mediaTier";
Expression = {
if ($_.tier -eq "Premium") {
"SSD"
} elseif ($_.tier -eq "Standard") {
"HDD"
} else {
"Unknown"
}
}
}, `
@{
Name = "billingModel";
Expression = {
if ($_.name.StartsWith("StandardV2_") -or
$_.name.StartsWith("PremiumV2_")
) {
"ProvisionedV2"
} elseif ($_.name.StartsWith("Premium_")) {
"ProvisionedV1"
} else {
"PayAsYouGo"
}
}
}, `
@{
Name = "location";
Expression = { $_.locations | Select-Object -First 1 }
} | ft sku, kind, mediaTier, billingModel, location
}
# Login to Azure account
Az login
# Track down the subscription ID in GUID format and set subscription ID
subscriptionID="your-subscription-id-number"
# Get Token
token=$(az account get-access-token --query accessToken --output tsv)
# Invoke SRP list SKU API, and get the returned SKU list
result=$(az rest --method get --uri "https://management.chinacloudapi.cn/subscriptions/$subscriptionID/providers/Microsoft.Storage/skus?api-version=2024-01-01" --headers "Authorization=Bearer $token")
# Filter the SKU list to get the required information, customization required here to get the best result.
filteredResult=$(echo $result | jq '.value[] | select(.resourceType == "storageAccounts" and (.kind == "FileStorage" or .kind == "StorageV2") and (.name | test("^(?!Standard_RAGRS|Standard_RAGZRS)")))' )
if [ -z "$filteredResult" ]; then
echo "No results found."
else
# Print the table header
printf "%-30s %-15s %-10s %-20s %-15s\n" "SKU" "Kind" "MediaTier" "BillingModel" "Location"
# Print the filtered results
echo $filteredResult | jq -r '. | "\(.name)\t\(.kind)\t\(.tier | if . == "Premium" then "SSD" elif . == "Standard" then "HDD" else "Unknown" end)\t\(.name | if test("^StandardV2_|^PremiumV2_") then "ProvisionedV2" elif test("^Premium_") then "ProvisionedV1" else "PayAsYouGo" end)\t\(.locations)"' | while IFS=$'\t' read -r sku kind mediaTier billingModel location; do
printf "%-30s %-15s %-10s %-20s %-15s\n" "$sku" "$kind" "$mediaTier" "$billingModel" "$location"
done
fi