New-StorageShare
Azure: Creates a storage file share
param(
[Parameter(Mandatory = $true)]
[string]$Name,
[Parameter(Mandatory = $false)]
[int]$Quota,
[Parameter(Mandatory = $true)]
[string]$StorageAccountName
)
try {
Import-Module Az.Storage -ErrorAction Stop
$ctx = (Get-AzStorageAccount -ResourceGroupName "*" -Name $StorageAccountName -ErrorAction Stop).Context
[hashtable]$cmdArgs = @{ 'Name' = $Name; 'Context' = $ctx; 'ErrorAction' = 'Stop' }
if ($Quota) { $cmdArgs.Add('Quota', $Quota) }
$share = New-AzStorageShare @cmdArgs
Write-Output $share
} catch {
Write-Error $_
exit 1
}The name for the new file share.
The maximum size of the share in GB (optional).
The name of the storage account.