Get-StorageShare
Azure: Gets storage shares
param(
[Parameter(Mandatory = $false)]
[string]$Name,
[Parameter(Mandatory = $true)]
[string]$StorageAccountName
)
try {
Import-Module Az.Storage -ErrorAction Stop
$ctx = (Get-AzStorageAccount -ResourceGroupName "*" -Name $StorageAccountName -ErrorAction Stop).Context
[hashtable]$cmdArgs = @{ 'Context' = $ctx; 'ErrorAction' = 'Stop' }
if ($Name) { $cmdArgs.Add('Name', $Name) }
$shares = Get-AzStorageShare @cmdArgs
Write-Output $shares
} catch {
Write-Error $_
exit 1
}The name or prefix of the share(s) to list (optional).
The name of the storage account.