# Login to Azure account
Connect-AzAccount
# 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.azure.com/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 required 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
}