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 @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.ApplicationInsights" Version="0.3.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="16.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="17.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/EventGrid/EventGrid.Test/EventGrid.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.Azure.Management.EventHub" Version="2.5.0" />
<PackageReference Include="Microsoft.Azure.Management.Relay" Version="2.0.2" />
<PackageReference Include="Microsoft.Azure.Management.ServiceBus" Version="2.1.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="16.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="17.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.20.0-preview" />
<PackageReference Include="Microsoft.Azure.OperationalInsights" Version="0.10.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="16.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="17.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ 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 -EnabledProtocol NFS -RootSquash RootSquash
$stos | New-AzRmStorageShare -Name $shareName2 -QuotaGiB $quotaGiB -Metadata $metadata -EnabledProtocol NFS -RootSquash RootSquash -AccessTier Cool
$share = $stos | Get-AzRmStorageShare -Name $shareName2
Assert-AreEqual $rgname $share.ResourceGroupName
Assert-AreEqual $stoname $share.StorageAccountName
Expand All @@ -77,8 +77,9 @@ function Test-StorageFileShare
Assert-AreEqual $metadata.Count $share.Metadata.Count
#Assert-AreEqual "NFS" $share.EnabledProtocols
#Assert-AreEqual "RootSquash" $share.RootSquash
Assert-AreEqual "Cool" $share.Accesstier

Update-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName2 -RootSquash NoRootSquash
Update-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName2 -RootSquash NoRootSquash -AccessTier Hot
$share = $stos | Get-AzRmStorageShare -Name $shareName2
Assert-AreEqual $rgname $share.ResourceGroupName
Assert-AreEqual $stoname $share.StorageAccountName
Expand All @@ -87,6 +88,7 @@ function Test-StorageFileShare
Assert-AreEqual $metadata.Count $share.Metadata.Count
#Assert-AreEqual "NFS" $share.EnabledProtocols
#Assert-AreEqual "NoRootSquash" $share.RootSquash
Assert-AreEqual "Hot" $share.Accesstier

$shares = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname
Assert-AreEqual 2 $shares.Count
Expand Down Expand Up @@ -153,6 +155,12 @@ function Test-ShareSoftDelete
Assert-AreEqual $shareName1 $share.Name
New-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName2

# Get share usage
$share = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -GetShareUsage
Assert-AreEqual $shareName1 $share.Name
Assert-AreEqual 0 $share.ShareUsageBytes
Assert-AreEqual $null $share.Deleted

#delete share
Remove-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -Force

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.0.0" />
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.2.0" />
<PackageReference Include="Azure.Storage.Queues" Version="12.3.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="16.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="17.0.0" />
</ItemGroup>

</Project>
7 changes: 6 additions & 1 deletion src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
- Additional information about change #1
-->
## Upcoming Release

* Support get single file share usage
- `Get-AzRmStorageShare`
* Support create/update file share with access tier
- `New-AzRmStorageShare`
- `Update-AzRmStorageShare`

## Version 2.0.1
* Support enable/disable/get share soft delete properties on file Service of a Storage account
- `Update-AzStorageFileServiceProperty`
Expand Down
23 changes: 20 additions & 3 deletions src/Storage/Storage.Management/File/GetAzureStorageShare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace Microsoft.Azure.Commands.Management.Storage
{
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMStoragePrefix + StorageShareNounStr, DefaultParameterSetName = AccountNameParameterSet), OutputType(typeof(PSShare))]
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMStoragePrefix + StorageShareNounStr, DefaultParameterSetName = AccountNameSingleParameterSet), OutputType(typeof(PSShare))]
public class GetAzureStorageShareCommand : StorageFileBaseCmdlet
{
/// <summary>
Expand Down Expand Up @@ -113,7 +113,18 @@ public class GetAzureStorageShareCommand : StorageFileBaseCmdlet
HelpMessage = "Include deleted shares, by default list shares won't include deleted shares",
ParameterSetName = AccountObjectParameterSet)]
public SwitchParameter IncludeDeleted { get; set; }


[Parameter(HelpMessage = "Specify this parameter to get the Share Usage in Bytes.",
Mandatory = false,
ParameterSetName = AccountObjectSingleParameterSet)]
[Parameter(HelpMessage = "Specify this parameter to get the Share Usage in Bytes.",
Mandatory = false,
ParameterSetName = AccountNameSingleParameterSet)]
[Parameter(HelpMessage = "Specify this parameter to get the Share Usage in Bytes.",
Mandatory = false,
ParameterSetName = ShareResourceIdParameterSet)]
public SwitchParameter GetShareUsage { get; set; }

public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
Expand All @@ -138,10 +149,16 @@ public override void ExecuteCmdlet()

if (!string.IsNullOrEmpty(this.Name))
{
GetShareExpand? expend = null;
if(this.GetShareUsage)
{
expend = GetShareExpand.Stats;
}
var Share = this.StorageClient.FileShares.Get(
this.ResourceGroupName,
this.StorageAccountName,
this.Name);
this.Name,
expend);
WriteObject(new PSShare(Share));
}
else
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 @@ -102,6 +102,29 @@ public int QuotaGiB
IgnoreCase = true)]
public string RootSquash { 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 @@ -136,7 +159,8 @@ public override void ExecuteCmdlet()
metadata: MetadataDictionary,
shareQuota: shareQuota,
enabledProtocols: this.EnabledProtocol,
rootSquash: this.RootSquash));
rootSquash: this.RootSquash,
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 @@ -126,6 +127,28 @@ public int QuotaGiB
IgnoreCase = true)]
public string RootSquash { 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 @@ -162,7 +185,8 @@ public override void ExecuteCmdlet()
new FileShare(
metadata: MetadataDictionary,
shareQuota: shareQuota,
rootSquash: this.RootSquash));
rootSquash: this.RootSquash,
accessTier: accessTier));

WriteObject(new PSShare(Share));
}
Expand Down
4 changes: 0 additions & 4 deletions src/Storage/Storage.Management/Models/PSShare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public PSShare(StorageModels.FileShare share)
this.Etag = share.Etag;
this.LastModifiedTime = share.LastModifiedTime;
this.QuotaGiB = share.ShareQuota;
this.EnabledProtocols = share.EnabledProtocols;
this.RootSquash = share.RootSquash;
this.Version = share.Version;
this.Deleted = share.Deleted;
this.DeletedTime = share.DeletedTime;
Expand All @@ -64,8 +62,6 @@ public PSShare(FileShareItem share)
this.Etag = share.Etag;
this.LastModifiedTime = share.LastModifiedTime;
this.QuotaGiB = share.ShareQuota;
this.EnabledProtocols = share.EnabledProtocols;
this.RootSquash = share.RootSquash;
this.Version = share.Version;
this.Deleted = share.Deleted;
this.DeletedTime = share.DeletedTime;
Expand Down
2 changes: 1 addition & 1 deletion src/Storage/Storage.Management/Storage.Management.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<RootNamespace>$(LegacyAssemblyPrefix)$(PsModuleName)</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="16.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="17.0.0" />
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.1.1" />
<PackageReference Include="Microsoft.Azure.Storage.File" Version="11.1.1" />
<PackageReference Include="Microsoft.Azure.Storage.Queue" Version="11.1.1" />
Expand Down
49 changes: 39 additions & 10 deletions src/Storage/Storage.Management/help/Get-AzRmStorageShare.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ Gets or lists Storage file shares.

## SYNTAX

### AccountName (Default)
### AccountNameSingle (Default)
```
Get-AzRmStorageShare [-ResourceGroupName] <String> [-StorageAccountName] <String> [-IncludeDeleted]
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Get-AzRmStorageShare [-ResourceGroupName] <String> [-StorageAccountName] <String> [-Name <String>]
[-GetShareUsage] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

### AccountNameSingle
### AccountName
```
Get-AzRmStorageShare [-ResourceGroupName] <String> [-StorageAccountName] <String> [-Name <String>]
Get-AzRmStorageShare [-ResourceGroupName] <String> [-StorageAccountName] <String> [-IncludeDeleted]
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

### AccountObjectSingle
```
Get-AzRmStorageShare -StorageAccount <PSStorageAccount> -Name <String>
Get-AzRmStorageShare -StorageAccount <PSStorageAccount> -Name <String> [-GetShareUsage]
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
```

Expand All @@ -38,7 +38,8 @@ Get-AzRmStorageShare -StorageAccount <PSStorageAccount> [-IncludeDeleted]

### ShareResourceId
```
Get-AzRmStorageShare [-ResourceId] <String> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
Get-AzRmStorageShare [-ResourceId] <String> [-GetShareUsage] [-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -100,6 +101,19 @@ share1 100 TransactionOptimized True 01D61FD1FC5498B6

This command lists all Storage file shares include the deleted shares of a Storage account with Storage account name.

### Example 5: Get a Storage file share with the share usage in bytes
```
PS C:\>Get-AzRmStorageShare -ResourceGroupName "myresourcegroup" -StorageAccountName "mystorageaccount" -Name "myshare" -GetShareUsage

ResourceGroupName: myresourcegroup, StorageAccountName: mystorageaccount

Name QuotaGiB EnabledProtocol5 AccessTier Deleted Version ShareUsageBytes
---- -------- ---------------- ---------- ------- ------- ---------------
myshare 5120 2097152
```

This command gets a Storage file share with Storage account name and share name, and include the share usage in bytes.

## PARAMETERS

### -DefaultProfile
Expand All @@ -117,6 +131,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -GetShareUsage
Specify this parameter to get the Share Usage in Bytes.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: AccountNameSingle, AccountObjectSingle, ShareResourceId
Aliases:

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

### -IncludeDeleted
Include deleted shares, by default list shares won't include deleted shares

Expand Down Expand Up @@ -164,7 +193,7 @@ Resource Group Name.

```yaml
Type: System.String
Parameter Sets: AccountName, AccountNameSingle
Parameter Sets: AccountNameSingle, AccountName
Aliases:

Required: True
Expand Down Expand Up @@ -209,7 +238,7 @@ Storage Account Name.

```yaml
Type: System.String
Parameter Sets: AccountName, AccountNameSingle
Parameter Sets: AccountNameSingle, AccountName
Aliases: AccountName

Required: True
Expand All @@ -220,7 +249,7 @@ Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

Expand Down
Loading