New-AzRmStorageShare
Creates a Storage file share.
Syntax
New-AzRmStorageShare
[-ResourceGroupName] <String>
[-StorageAccountName] <String>
-Name <String>
[-QuotaGiB <Int32>]
[-Metadata <Hashtable>]
[-AccessTier <String>]
[-Snapshot]
[-EnabledProtocol <String>]
[-RootSquash <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzRmStorageShare
-StorageAccount <PSStorageAccount>
-Name <String>
[-QuotaGiB <Int32>]
[-Metadata <Hashtable>]
[-AccessTier <String>]
[-Snapshot]
[-EnabledProtocol <String>]
[-RootSquash <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The New-AzRmStorageShare cmdlet creates a Storage file share.
Examples
Example 1: Create a Storage file share with Storage account name and share name, with metadata and share quota as 100 GiB.
New-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Name "myshare" -QuotaGiB 100 -Metadata @{"tag1" = "value1"; "tag2" = "value2" }
ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount
Name QuotaGiB EnabledProtocol AccessTier Deleted Version ShareUsageBytes
---- -------- --------------- ---------- ------- ------- ---------------
myshare
This command creates a Storage file share with metadata and share quota as 100 GiB.
Example 2: Create a Storage file share with Storage account object
Get-AzStorageAccount -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" | New-AzRmStorageShare -Name "myshare"
ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount
Name QuotaGiB EnabledProtocol AccessTier Deleted Version ShareUsageBytes
---- -------- --------------- ---------- ------- ------- ---------------
myshare
This command creates a Storage file share with Storage account object and share name.
Example 3: Create a Storage file share with accesstier as Hot
$share = New-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Name "myshare" -AccessTier Hot
ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount
Name QuotaGiB EnabledProtocols AccessTier Deleted Version ShareUsageBytes
---- -------- ---------------- ---------- ------- ------- ---------------
myshare Hot
This command creates a Storage file share with accesstier as Hot.
Example 4: Create a Storage file share snapshot of an existing share
$shareSnapshot = New-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Name "myshare" -Snapshot
ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount
Name QuotaGiB EnabledProtocols AccessTier Deleted Version ShareUsageBytes snapshotTime
---- -------- ---------------- ---------- ------- ------- --------------- ------------
myshare 2021-05-10T08:04:08
This command creates a Storage file share snapshot of an existing base file share.
Example 5: Create a Storage file share with EnabledProtocol proeprty as NFS, and RootSquash property as NoRootSquash
$share = New-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Name "myshare" -EnabledProtocol NFS -RootSquash NoRootSquash
$share
ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount
Name QuotaGiB EnabledProtocols AccessTier Deleted Version ShareUsageBytes
---- -------- ---------------- ---------- ------- ------- ---------------
myshare NFS
$share.RootSquash
NoRootSquash
This command creates a Storage file share with EnabledProtocol proeprty as NFS, and RootSquash proeprty as NoRootSquash.
Parameters
-AccessTier
Access tier for specific share. StorageV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium.
Type: | String |
Accepted values: | TransactionOptimized, Premium, Hot, Cool |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-EnabledProtocol
Sets protocols for file shares. It cannot be changed after file share creation. Possible values include: 'SMB', 'NFS'
Type: | String |
Accepted values: | NFS, SMB |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Metadata
Share Metadata
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
Azure File share name
Type: | String |
Aliases: | N, ShareName |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-QuotaGiB
Share Quota in Gibibyte.
Type: | Int32 |
Aliases: | Quota |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ResourceGroupName
Resource Group Name.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-RootSquash
Sets reduction of the access rights for the remote superuser. Possible values include: 'NoRootSquash', 'RootSquash', 'AllSquash'
Type: | String |
Accepted values: | NoRootSquash, RootSquash, AllSquash |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Snapshot
Create a snapshot of existing share with same name.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-StorageAccount
Storage account object
Type: | PSStorageAccount |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StorageAccountName
Storage Account Name.
Type: | String |
Aliases: | AccountName |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |