Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ function Test-StorageFileShare
$quotaGiB = 300
$metadata = @{tag0="value0";tag1="value1";tag2="value2";tag3="value3"}
$shareName2 = "share2"+ $rgname
$stos | New-AzRmStorageShare -Name $shareName2 -QuotaGiB $quotaGiB -Metadata $metadata
$stos | New-AzRmStorageShare -Name $shareName2 -QuotaGiB $quotaGiB -Metadata $metadata -AccessTier Cool
$share = $stos | Get-AzRmStorageShare -Name $shareName2
Assert-AreEqual $rgname $share.ResourceGroupName
Assert-AreEqual $stoname $share.StorageAccountName
Assert-AreEqual $shareName2 $share.Name
Assert-AreEqual $quotaGiB $share.QuotaGiB
Assert-AreEqual $metadata.Count $share.Metadata.Count
Assert-AreEqual "Cool" $share.Accesstier
Update-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName2 -AccessTier Hot
$share = $stos | Get-AzRmStorageShare -Name $shareName2
Assert-AreEqual "Hot" $share.Accesstier

$shares = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname
Assert-AreEqual 2 $shares.Count
Expand Down

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
- Additional information about change #1
-->
## Upcoming Release
* Support create/update file share with access tier
- `New-AzRmStorageShare`
- `Update-AzRmStorageShare`
Comment on lines +22 to +23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `New-AzRmStorageShare`
- `Update-AzRmStorageShare`
- `New-AzStorageShare`
- `Update-AzStorageShare`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change log is right.
We have 2 set of File share cmdlet:

  1. Dataplane , like New-AzStorageShare
  2. Mgmt plane, like New-AzRmStorageShare.

The new properties only support on Mgmt plane, so should change the cmdlet name like "*-RmStorageShare"


## Version 2.7.0
* Supported enable/disable/get share soft delete properties on file Service of a Storage account
Expand Down
26 changes: 25 additions & 1 deletion src/Storage/Storage.Management/File/NewAzureStorageShare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,29 @@ public int QuotaGiB
[ValidateNotNull]
public Hashtable Metadata { get; set; }


[Parameter(
Mandatory = false,
HelpMessage = "Access tier for specific share. StorageV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium.")]
[ValidateSet(ShareAccessTier.TransactionOptimized,
ShareAccessTier.Premium,
ShareAccessTier.Hot,
ShareAccessTier.Cool,
IgnoreCase = true)]
[ValidateNotNullOrEmpty]
public string AccessTier
{
get
{
return accessTier;
}
set
{
accessTier = value;
}
}
private string accessTier = null;

public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
Expand All @@ -113,7 +136,8 @@ public override void ExecuteCmdlet()
this.Name,
new FileShare(
metadata: MetadataDictionary,
shareQuota: shareQuota));
shareQuota: shareQuota,
accessTier: accessTier));

WriteObject(new PSShare(share));
}
Expand Down
26 changes: 25 additions & 1 deletion src/Storage/Storage.Management/File/UpdateAzureStorageShare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Management.Storage.Models;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
using Microsoft.Azure.Management.Storage;
using Microsoft.Azure.Management.Storage.Models;
Expand Down Expand Up @@ -118,6 +119,28 @@ public int QuotaGiB
[ValidateNotNull]
public Hashtable Metadata { get; set; }

[Parameter(
Mandatory = false,
HelpMessage = "Access tier for specific share. StorageV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium.")]
[ValidateSet(ShareAccessTier.TransactionOptimized,
ShareAccessTier.Premium,
ShareAccessTier.Hot,
ShareAccessTier.Cool,
IgnoreCase = true)]
[ValidateNotNullOrEmpty]
public string AccessTier
{
get
{
return accessTier;
}
set
{
accessTier = value;
}
}
private string accessTier = null;

public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
Expand Down Expand Up @@ -153,7 +176,8 @@ public override void ExecuteCmdlet()
this.Name,
new FileShare(
metadata: MetadataDictionary,
shareQuota: shareQuota));
shareQuota: shareQuota,
accessTier: accessTier));

WriteObject(new PSShare(Share));
}
Expand Down
36 changes: 33 additions & 3 deletions src/Storage/Storage.Management/help/New-AzRmStorageShare.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ Creates a Storage file share.
### AccountName (Default)
```
New-AzRmStorageShare [-ResourceGroupName] <String> [-StorageAccountName] <String> -Name <String>
[-QuotaGiB <Int32>] [-Metadata <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
[-QuotaGiB <Int32>] [-Metadata <Hashtable>] [-AccessTier <String>] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### AccountObject
```
New-AzRmStorageShare -StorageAccount <PSStorageAccount> -Name <String> [-QuotaGiB <Int32>]
[-Metadata <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-Metadata <Hashtable>] [-AccessTier <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -56,8 +57,37 @@ 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
```
PS C:\>$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.

## PARAMETERS

### -AccessTier
Access tier for specific share. StorageV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:
Accepted values: TransactionOptimized, Premium, Hot, Cool

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.

Expand Down
40 changes: 35 additions & 5 deletions src/Storage/Storage.Management/help/Update-AzRmStorageShare.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,27 @@ Modifies a Storage file share.
### AccountName (Default)
```
Update-AzRmStorageShare [-ResourceGroupName] <String> [-StorageAccountName] <String> -Name <String>
[-QuotaGiB <Int32>] [-Metadata <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
[-QuotaGiB <Int32>] [-Metadata <Hashtable>] [-AccessTier <String>] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### AccountObject
```
Update-AzRmStorageShare -Name <String> -StorageAccount <PSStorageAccount> [-QuotaGiB <Int32>]
[-Metadata <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-Metadata <Hashtable>] [-AccessTier <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### ShareResourceId
```
Update-AzRmStorageShare [-ResourceId] <String> [-QuotaGiB <Int32>] [-Metadata <Hashtable>]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-AccessTier <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### ShareObject
```
Update-AzRmStorageShare -InputObject <PSShare> [-QuotaGiB <Int32>] [-Metadata <Hashtable>]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-AccessTier <String>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -86,8 +87,37 @@ share2 5000

This command modifies share quota as 5000 GiB for all Storage file shares in a Storage account with pipeline.

### Example 4: Modify a Storage file share with accesstier as Cool
```
PS C:\>$share = Update-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Name "myshare" -AccessTier Cool

ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name QuotaGiB EnabledProtocols AccessTier Deleted Version ShareUsageBytes
---- -------- ---------------- ---------- ------- ------- ---------------
myshare Cool
```

This command modifies a Storage file share with accesstier as Cool.

## PARAMETERS

### -AccessTier
Access tier for specific share. StorageV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:
Accepted values: TransactionOptimized, Premium, Hot, Cool

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.

Expand Down