Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Storage] Support File share snapshot #14937

Merged
merged 3 commits into from May 11, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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="21.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="22.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/EventGrid/EventGrid.Test/EventGrid.Test.csproj
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.Azure.Management.EventHub" Version="2.7.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="21.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="22.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/IotHub/IotHub.Test/IotHub.Test.csproj
Expand Up @@ -14,7 +14,7 @@
<PackageReference Include="Microsoft.Azure.Devices" Version="1.22.0" />
<PackageReference Include="Microsoft.Azure.Management.EventHub" Version="2.7.0" />
<PackageReference Include="Microsoft.Azure.Management.IotHub" Version="3.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="21.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="22.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Network/Network.Test/Network.Test.csproj
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="Microsoft.Azure.Management.Redis" Version="4.4.1" />
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.21.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.ManagedServiceIdentity" Version="0.10.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="21.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="22.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Expand Up @@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.OperationalInsights" Version="0.21.0-preview" />
<PackageReference Include="Microsoft.Azure.OperationalInsights" Version="0.10.0-preview" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="21.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="22.0.0" />
</ItemGroup>

</Project>
Expand Up @@ -317,8 +317,8 @@
"StatusCode": 201
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/checkNameAvailability?api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9jaGVja05hbWVBdmFpbGFiaWxpdHk/YXBpLXZlcnNpb249MjAyMS0wMi0wMQ==",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/checkNameAvailability?api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9jaGVja05hbWVBdmFpbGFiaWxpdHk/YXBpLXZlcnNpb249MjAyMS0wNC0wMQ==",
"RequestMethod": "POST",
"RequestBody": "{\r\n \"name\": \"azpstestaccountmock1\",\r\n \"type\": \"Microsoft.Storage/storageAccounts\"\r\n}",
"RequestHeaders": {
Expand Down Expand Up @@ -386,8 +386,8 @@
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/checkNameAvailability?api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9jaGVja05hbWVBdmFpbGFiaWxpdHk/YXBpLXZlcnNpb249MjAyMS0wMi0wMQ==",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/checkNameAvailability?api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9jaGVja05hbWVBdmFpbGFiaWxpdHk/YXBpLXZlcnNpb249MjAyMS0wNC0wMQ==",
"RequestMethod": "POST",
"RequestBody": "{\r\n \"name\": \"azpstestaccountmock2\",\r\n \"type\": \"Microsoft.Storage/storageAccounts\"\r\n}",
"RequestHeaders": {
Expand Down Expand Up @@ -455,8 +455,8 @@
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock1?api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2sxP2FwaS12ZXJzaW9uPTIwMjEtMDItMDE=",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock1?api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2sxP2FwaS12ZXJzaW9uPTIwMjEtMDQtMDE=",
"RequestMethod": "PUT",
"RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_LRS\"\r\n },\r\n \"kind\": \"StorageV2\",\r\n \"location\": \"East US\"\r\n}",
"RequestHeaders": {
Expand Down Expand Up @@ -487,7 +487,7 @@
"no-cache"
],
"Location": [
"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/locations/eastus/asyncoperations/be97bb47-8892-4065-92aa-d764724f60f8?monitor=true&api-version=2021-02-01"
"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/locations/eastus/asyncoperations/be97bb47-8892-4065-92aa-d764724f60f8?monitor=true&api-version=2021-04-01"
],
"Retry-After": [
"17"
Expand Down Expand Up @@ -530,8 +530,8 @@
"StatusCode": 202
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/locations/eastus/asyncoperations/be97bb47-8892-4065-92aa-d764724f60f8?monitor=true&api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9sb2NhdGlvbnMvZWFzdHVzL2FzeW5jb3BlcmF0aW9ucy9iZTk3YmI0Ny04ODkyLTQwNjUtOTJhYS1kNzY0NzI0ZjYwZjg/bW9uaXRvcj10cnVlJmFwaS12ZXJzaW9uPTIwMjEtMDItMDE=",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/locations/eastus/asyncoperations/be97bb47-8892-4065-92aa-d764724f60f8?monitor=true&api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9sb2NhdGlvbnMvZWFzdHVzL2FzeW5jb3BlcmF0aW9ucy9iZTk3YmI0Ny04ODkyLTQwNjUtOTJhYS1kNzY0NzI0ZjYwZjg/bW9uaXRvcj10cnVlJmFwaS12ZXJzaW9uPTIwMjEtMDQtMDE=",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
Expand Down Expand Up @@ -587,8 +587,8 @@
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock1?api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2sxP2FwaS12ZXJzaW9uPTIwMjEtMDItMDE=",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock1?api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2sxP2FwaS12ZXJzaW9uPTIwMjEtMDQtMDE=",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
Expand Down Expand Up @@ -650,8 +650,8 @@
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock2?api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2syP2FwaS12ZXJzaW9uPTIwMjEtMDItMDE=",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock2?api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2syP2FwaS12ZXJzaW9uPTIwMjEtMDQtMDE=",
"RequestMethod": "PUT",
"RequestBody": "{\r\n \"sku\": {\r\n \"name\": \"Standard_LRS\"\r\n },\r\n \"kind\": \"StorageV2\",\r\n \"location\": \"East US\"\r\n}",
"RequestHeaders": {
Expand Down Expand Up @@ -682,7 +682,7 @@
"no-cache"
],
"Location": [
"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/locations/eastus/asyncoperations/355b5a7c-6991-4f35-9bac-e5d358452b50?monitor=true&api-version=2021-02-01"
"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/locations/eastus/asyncoperations/355b5a7c-6991-4f35-9bac-e5d358452b50?monitor=true&api-version=2021-04-01"
],
"Retry-After": [
"17"
Expand Down Expand Up @@ -725,8 +725,8 @@
"StatusCode": 202
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/locations/eastus/asyncoperations/355b5a7c-6991-4f35-9bac-e5d358452b50?monitor=true&api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9sb2NhdGlvbnMvZWFzdHVzL2FzeW5jb3BlcmF0aW9ucy8zNTViNWE3Yy02OTkxLTRmMzUtOWJhYy1lNWQzNTg0NTJiNTA/bW9uaXRvcj10cnVlJmFwaS12ZXJzaW9uPTIwMjEtMDItMDE=",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Storage/locations/eastus/asyncoperations/355b5a7c-6991-4f35-9bac-e5d358452b50?monitor=true&api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Byb3ZpZGVycy9NaWNyb3NvZnQuU3RvcmFnZS9sb2NhdGlvbnMvZWFzdHVzL2FzeW5jb3BlcmF0aW9ucy8zNTViNWE3Yy02OTkxLTRmMzUtOWJhYy1lNWQzNTg0NTJiNTA/bW9uaXRvcj10cnVlJmFwaS12ZXJzaW9uPTIwMjEtMDQtMDE=",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
Expand Down Expand Up @@ -782,8 +782,8 @@
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock2?api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2syP2FwaS12ZXJzaW9uPTIwMjEtMDItMDE=",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock2?api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2syP2FwaS12ZXJzaW9uPTIwMjEtMDQtMDE=",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
Expand Down Expand Up @@ -1298,8 +1298,8 @@
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock1?api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2sxP2FwaS12ZXJzaW9uPTIwMjEtMDItMDE=",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock1?api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2sxP2FwaS12ZXJzaW9uPTIwMjEtMDQtMDE=",
"RequestMethod": "DELETE",
"RequestBody": "",
"RequestHeaders": {
Expand Down Expand Up @@ -1361,8 +1361,8 @@
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock2?api-version=2021-02-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2syP2FwaS12ZXJzaW9uPTIwMjEtMDItMDE=",
"RequestUri": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ps9940/providers/Microsoft.Storage/storageAccounts/azpstestaccountmock2?api-version=2021-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOWUyMjNkYmUtMzM5OS00ZTE5LTg4ZWItMDk3NWYwMmFjODdmL3Jlc291cmNlR3JvdXBzL3BzOTk0MC9wcm92aWRlcnMvTWljcm9zb2Z0LlN0b3JhZ2Uvc3RvcmFnZUFjY291bnRzL2F6cHN0ZXN0YWNjb3VudG1vY2syP2FwaS12ZXJzaW9uPTIwMjEtMDQtMDE=",
"RequestMethod": "DELETE",
"RequestBody": "",
"RequestHeaders": {
Expand Down
2 changes: 1 addition & 1 deletion src/Search/Search.Test/Search.Test.csproj
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Search" Version="4.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="21.0.0" />
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="22.0.0" />
</ItemGroup>

</Project>
Expand Up @@ -51,5 +51,12 @@ public void TestShareSoftDeletee()
{
TestController.NewInstance.RunPsTest(_logger, "Test-ShareSoftDelete");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestShareSnapshot()
{
TestController.NewInstance.RunPsTest(_logger, "Test-ShareSnapshot");
}
}
}
105 changes: 105 additions & 0 deletions src/Storage/Storage.Management.Test/ScenarioTests/StorageFileTests.ps1
Expand Up @@ -254,3 +254,108 @@ function Test-ShareSoftDelete
}


<#
.SYNOPSIS
Test Storage File Share Snapshot
.DESCRIPTION
SmokeTest
#>
function Test-ShareSnapshot
{
# Setup
$rgname = Get-StorageManagementTestResourceName;

try
{
# Test
$stoname = 'sto' + $rgname;
$stotype = 'Standard_LRS';
$loc = Get-ProviderLocation ResourceManagement;
$kind = 'StorageV2'
$shareName1 = "share1"+ $rgname
$shareName2 = "share2"+ $rgname

Write-Verbose "RGName: $rgname | Loc: $loc"
New-AzResourceGroup -Name $rgname -Location $loc;

$loc = Get-ProviderLocation_Stage ResourceManagement;
New-AzStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype -Kind $kind
$stos = Get-AzStorageAccount -ResourceGroupName $rgname;

# Enable Share Soft delete
Update-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname -EnableShareDeleteRetentionPolicy $true -ShareRetentionDays 5
$servicePropertie = Get-AzStorageFileServiceProperty -ResourceGroupName $rgname -StorageAccountName $stoname
Assert-AreEqual $true $servicePropertie.ShareDeleteRetentionPolicy.Enabled
Assert-AreEqual 5 $servicePropertie.ShareDeleteRetentionPolicy.Days

#create Shares
New-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1
$share = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1
Assert-AreEqual $rgname $share.ResourceGroupName
Assert-AreEqual $stoname $share.StorageAccountName
Assert-AreEqual $shareName1 $share.Name
New-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName2

# Create Share Snapshot
$shareSnapshot11 = New-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -Snapshot
Assert-AreEqual $shareName1 $shareSnapshot11.Name
# Assert-AreEqual 0 $share.ShareUsageBytes
#Assert-AreEqual $null $share.Deleted
# Assert-AreNotEqual $null $share.SnapshotTime
$shareSnapshot12 = New-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -Snapshot
$shareSnapshot21 = New-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName2 -Snapshot

# list Shares with IncludeSnapshot
$shares = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -IncludeSnapshot
# Assert-AreEqual 6 $shares.Count

# Get single share snapshot
$sharesp1 = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -SnapshotTime $shareSnapshot11.SnapshotTime
Assert-AreEqual $shareName1 $sharesp1.Name
# Assert-AreEqual $shareSnapshot11.SnapshotTime $shareName1.SnapshotTime

#delete single share snapshot
Remove-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -SnapshotTime $shareSnapshot11.SnapshotTime -Force

# list Shares
$shares = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -IncludeSnapshot
# Assert-AreEqual 5 $shares.Count
$shares = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -IncludeSnapshot -IncludeDeleted
# Assert-AreEqual 6 $shares.Count
$shares = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -IncludeDeleted
# Assert-AreEqual 2 $shares.Count

# Delete share Default Include (None)
$Error.Clear()
Remove-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -Force -ErrorAction SilentlyContinue
# Assert-AreEqual 1 $Error.Count
# Assert-AreEqual 409 $Error[0].Exception.Response.StatusCode

# Delete share Include None
$Error.Clear()
Remove-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -Include None -Force -ErrorAction SilentlyContinue
# Assert-AreEqual 1 $Error.Count
# Assert-AreEqual 409 $Error[0].Exception.Response.StatusCode

# Delete share Include Snapshots
$Error.Clear()
Remove-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -Include Snapshots -Force

# Delete share Include Leased-Snapshots
$Error.Clear()
Remove-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -Name $shareName1 -Include Leased-Snapshots -Force

# list Shares after delete
$shares = Get-AzRmStorageShare -ResourceGroupName $rgname -StorageAccountName $stoname -IncludeSnapshot
# Assert-AreEqual 0 $shares.Count

Remove-AzStorageAccount -Force -ResourceGroupName $rgname -Name $stoname;
}
finally
{
# Cleanup
Clean-ResourceGroup $rgname
}
}