Skip to content

Commit

Permalink
[Storage] Support NFSV3 in create account
Browse files Browse the repository at this point in the history
  • Loading branch information
blueww committed Jun 9, 2021
1 parent 6353626 commit 71d2b54
Show file tree
Hide file tree
Showing 6 changed files with 871 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,14 @@ public void TestStorageBlobInventory()
{
TestRunner.RunTestScript("Test-StorageBlobInventory");
}


[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestNewAzureStorageAccountEnableNfsV3()
{
TestRunner.RunTestScript("Test-NewAzureStorageAccountEnableNfsV3");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ function Test-NewSetAzureStorageAccountAllowSharedKeyAccess
Assert-AreEqual $stotype $sto.Sku.Name;
Assert-AreEqual $loc.ToLower().Replace(" ", "") $sto.Location;
Assert-AreEqual $kind $sto.Kind;
#Assert-AreEqual $false $sto.AllowSharedKeyAccess
Assert-AreEqual $false $sto.AllowSharedKeyAccess

Set-AzStorageAccount -ResourceGroupName $rgname -Name $stoname -AllowSharedKeyAccess $true -EnableHttpsTrafficOnly $true

Expand All @@ -1417,7 +1417,7 @@ function Test-NewSetAzureStorageAccountAllowSharedKeyAccess
Assert-AreEqual $stotype $sto.Sku.Name;
Assert-AreEqual $loc.ToLower().Replace(" ", "") $sto.Location;
Assert-AreEqual $kind $sto.Kind;
#Assert-AreEqual $true $sto.AllowSharedKeyAccess
Assert-AreEqual $true $sto.AllowSharedKeyAccess

Remove-AzStorageAccount -Force -ResourceGroupName $rgname -Name $stoname;
}
Expand Down Expand Up @@ -1946,4 +1946,57 @@ function Test-StorageBlobInventory
# Cleanup
Clean-ResourceGroup $rgname
}
}


<#
.SYNOPSIS
Test Test-NewAzureStorageAccountEnableNfsV3
.DESCRIPTION
SmokeTest
#>
function Test-NewAzureStorageAccountEnableNfsV3
{
# Setup
$rgname = Get-StorageManagementTestResourceName;

try
{
# Test
$stoname = 'sto' + $rgname;
$stotype = 'Standard_LRS';
$loc = Get-ProviderLocation_Canary ResourceManagement;
$kind = 'StorageV2'

$rg = New-AzResourceGroup -Name $rgname -Location $loc;
Write-Output ("Resource Group created")

## Create a vnet and subnet in same location, then get the subnet resource id
# New-AzVirtualNetwork -ResourceGroupName $rgname -Location $loc -AddressPrefix 10.0.0.0/24 -Name "vnet1"
# $subnet = Get-AzVirtualNetwork -ResourceGroupName $rgname -Name "vnet1" | Add-AzVirtualNetworkSubnetConfig -Name "subnet1" -AddressPrefix "10.0.0.0/28" -ServiceEndpoint "Microsoft.Storage" | Set-AzVirtualNetwork
# $vnet1 = $subnet.Id
$vnet1 = "$($rg.ResourceId)/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"

New-AzStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -SkuName $stotype `
-EnableNfsV3 $true `
-EnableHierarchicalNamespace $true `
-EnableHttpsTrafficOnly $false `
-NetworkRuleSet (@{bypass="Logging,Metrics";defaultAction="allow";virtualNetworkRules=(@{VirtualNetworkResourceId="$vnet1";Action="allow"})})

Retry-IfException { $global:sto = Get-AzStorageAccount -ResourceGroupName $rgname -Name $stoname; }
Assert-AreEqual $stoname $sto.StorageAccountName;
Assert-AreEqual $stotype $sto.Sku.Name;
Assert-AreEqual $loc.ToLower().Replace(" ", "") $sto.Location;
Assert-AreEqual $kind $sto.Kind;
Assert-AreEqual $true $sto.EnableHierarchicalNamespace
Assert-AreEqual $false $sto.EnableHttpsTrafficOnly
Assert-AreEqual $true $sto.EnableNfsV3

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

0 comments on commit 71d2b54

Please sign in to comment.