@@ -1334,13 +1334,31 @@ Describe "Management plan test" {
13341334 Get-AzStorageAccount - ResourceGroupName $rgname - Name $accountNameEncypScope | New-AzStorageEncryptionScope - EncryptionScopeName $scopename - KeyvaultEncryption - KeyUri $KeyUri
13351335
13361336 # get single scope
1337- Get-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope - EncryptionScopeName $scopename
1338-
1339- Get-AzStorageAccount - ResourceGroupName $rgname - Name $accountNameEncypScope | Get-AzStorageEncryptionScope - EncryptionScopeName $scopename
1337+ $scope = Get-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope - EncryptionScopeName $scopename
1338+ $scope.Name | Should - Be $scopename
1339+
1340+ $scope = Get-AzStorageAccount - ResourceGroupName $rgname - Name $accountNameEncypScope | Get-AzStorageEncryptionScope - EncryptionScopeName $scopename
1341+ $scope.Name | Should - Be $scopename
13401342
13411343 # list scope, will list all scopes
1342- Get-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope
1343- Get-AzStorageAccount - ResourceGroupName $rgname - Name $accountNameEncypScope | Get-AzStorageEncryptionScope
1344+ $scope3 = New-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope - EncryptionScopeName testscope3 - StorageEncryption
1345+ $scope4 = New-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope - EncryptionScopeName testscope4 - StorageEncryption
1346+ $scopes = Get-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope
1347+ $scopes.Count | Should - Be 4
1348+ $scopes = Get-AzStorageAccount - ResourceGroupName $rgname - Name $accountNameEncypScope | Get-AzStorageEncryptionScope
1349+ $scopes.Count | Should - Be 4
1350+
1351+ # list with include, filter, and maxpagesize
1352+ Update-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope - EncryptionScopeName testscope3 - State Disabled
1353+ $scopes = Get-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope - MaxPageSize 10 - Include Disabled
1354+ $scopes.Count | Should - Be 1
1355+ $scopes = Get-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope - MaxPageSize 2 - Include Enabled - Filter " startswith(name, test)"
1356+ $scopes.Count | Should - Be 2
1357+ ($scopes | ? {$_.Name -like " test*" }).Count | Should - Be 2
1358+ ($scopes | ? {$_.State -like " Enabled" }).Count | Should - Be 2
1359+ $scopes = Get-AzStorageEncryptionScope - ResourceGroupName $rgname - StorageAccountName $accountNameEncypScope - MaxPageSize 20 - Include All - Filter " startswith(name, test)"
1360+ $scopes.Count | Should - Be 3
1361+ ($scopes | ? {$_.Name -like " test*" }).Count | Should - Be 3
13441362
13451363 # Set to Disabled.
13461364 # ## Move the encryption scope to CMK by passing { 'properties': { 'state':'Disabled' } }
@@ -1710,11 +1728,11 @@ Describe "Management plan test" {
17101728 $rule2 = New-AzStorageBlobInventoryPolicyRule - Name Test2 - Destination $containerName - Format Parquet - Schedule Weekly - BlobType blockBlob - PrefixMatch aaa, bbb - BlobSchemaField name, Last- Modified, Metadata, LastAccessTime, AccessTierInferred # ,Tags
17111729 $rule3 = New-AzStorageBlobInventoryPolicyRule - Name Test3 - Destination $containerName - Format Parquet - Schedule Daily - IncludeSnapshot - BlobType blockBlob, appendBlob - PrefixMatch aaa, bbb `
17121730 - BlobSchemaField name, Creation- Time, Last- Modified, Content- Length, Content- MD5, BlobType, AccessTier, AccessTierChangeTime, Expiry- Time, hdi_isfolder, Owner, Group, Permissions, Acl, Metadata, LastAccessTime
1713- # $rule4 = New-AzStorageBlobInventoryPolicyRule -Name Test4 -Destination $containerName -Disabled - Format Csv -Schedule Weekly -BlobSchemaField Name, BlobType,Content-Length,Creation-Time -BlobType blockBlob -IncludeBlobVersion
1731+ $rule4 = New-AzStorageBlobInventoryPolicyRule - Name Test4 - Destination $containerName - Format Csv - Schedule Weekly - BlobType blockBlob - ExcludePrefix prefix1 , prefix2 - IncludeDeleted - BlobSchemaField Name , Content - CRC64 , Content - Type , LeaseStatus , EncryptionScope , DeletionId , Deleted , DeletedTime , RemainingRetentionDays
17141732
1715- $policy = Set-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv - Disabled - Rule $rule1 , $rule2 , $rule3
1733+ $policy = Set-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv - Disabled - Rule $rule1 , $rule2 , $rule3 , $rule4
17161734 $policy.Enabled | should - Be $false
1717- $policy.Rules.Count | should - be 3
1735+ $policy.Rules.Count | should - be 4
17181736 $policy.Rules [0 ].Name | should - be " Test1"
17191737 $policy.Rules [0 ].Enabled | should - Be $false
17201738 $policy.Rules [0 ].Destination | should - Be $containerName
@@ -1748,11 +1766,19 @@ Describe "Management plan test" {
17481766 $policy.Rules [2 ].Definition.Filters.IncludeSnapshots | should - Be $true
17491767 $policy.Rules [2 ].Definition.Filters.BlobTypes.Count | should - be 2
17501768 $policy.Rules [2 ].Definition.Filters.PrefixMatch.Count | should - be 2
1769+ $policy.Rules [3 ].Name | Should - Be " Test4"
1770+ $policy.Rules [3 ].Enabled | Should - Be $true
1771+ $policy.Rules [3 ].Destination | Should - Be $containerName
1772+ $policy.Rules [3 ].Definition.Format | Should - Be Csv
1773+ $policy.Rules [3 ].Definition.Schedule | Should - Be Weekly
1774+ $policy.Rules [3 ].Definition.Filters.ExcludePrefix.Count | Should - Be 2
1775+ $policy.Rules [3 ].Definition.Filters.IncludeDeleted | Should - Be $true
1776+ $policy.Rules [3 ].Definition.SchemaFields.Count | Should - Be 9
17511777 $policy = $null
17521778
17531779 $policy = Get-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv
17541780 $policy.Enabled | should - Be $false
1755- $policy.Rules.Count | should - be 3
1781+ $policy.Rules.Count | should - be 4
17561782 $policy.Rules [0 ].Name | should - be " Test1"
17571783 $policy.Rules [0 ].Enabled | should - Be $false
17581784 $policy.Rules [0 ].Destination | should - Be $containerName
@@ -1786,6 +1812,14 @@ Describe "Management plan test" {
17861812 $policy.Rules [2 ].Definition.Filters.IncludeSnapshots | should - Be $true
17871813 $policy.Rules [2 ].Definition.Filters.BlobTypes.Count | should - be 2
17881814 $policy.Rules [2 ].Definition.Filters.PrefixMatch.Count | should - be 2
1815+ $policy.Rules [3 ].Name | Should - Be " Test4"
1816+ $policy.Rules [3 ].Enabled | Should - Be $true
1817+ $policy.Rules [3 ].Destination | Should - Be $containerName
1818+ $policy.Rules [3 ].Definition.Format | Should - Be Csv
1819+ $policy.Rules [3 ].Definition.Schedule | Should - Be Weekly
1820+ $policy.Rules [3 ].Definition.Filters.ExcludePrefix.Count | Should - Be 2
1821+ $policy.Rules [3 ].Definition.Filters.IncludeDeleted | Should - Be $true
1822+ $policy.Rules [3 ].Definition.SchemaFields.Count | Should - Be 9
17891823 $policy = $null
17901824
17911825 $removeSuccess = Remove-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv - PassThru
@@ -1847,10 +1881,28 @@ Describe "Management plan test" {
18471881 PrefixMatch = @ (" conpre1" , " conpre2" );
18481882 })
18491883 })
1850- })
1884+ },
1885+ @ {
1886+ Enabled = $false ;
1887+ Name = " Test3" ;
1888+ Destination = $containerName ;
1889+ Definition = (@ {
1890+ ObjectType = " Blob" ;
1891+ Format = " Parquet" ;
1892+ Schedule = " Daily" ;
1893+ SchemaFields = @ (" name" , " Metadata" , " DeletionId" , " Deleted" , " DeletedTime" , " RemainingRetentionDays" , " Content-CRC64" , " Content-Type" , " LeaseStatus" , " EncryptionScope" );
1894+ Filters = (@ {
1895+ BlobTypes = @ (" blockBlob" , " appendBlob" );
1896+ PrefixMatch = @ (" conpre1" , " conpre2" );
1897+ ExcludePrefix = @ (" prefix1" , " prefix2" );
1898+ IncludeDeleted = $true ;
1899+ })
1900+ })
1901+ }
1902+ )
18511903 })
18521904 $policy.Enabled | should - Be $true
1853- $policy.Rules.Count | should - be 2
1905+ $policy.Rules.Count | should - be 3
18541906 $policy.Rules [0 ].Name | should - be " Test1"
18551907 $policy.Rules [0 ].Enabled | should - Be $true
18561908 $policy.Rules [0 ].Destination | should - Be $containerName
@@ -1873,12 +1925,22 @@ Describe "Management plan test" {
18731925 $policy.Rules [1 ].Definition.Filters.IncludeSnapshots | should - Be $null
18741926 $policy.Rules [1 ].Definition.Filters.BlobTypes| should - be $null
18751927 $policy.Rules [1 ].Definition.Filters.PrefixMatch.Count | should - be 2
1928+ $policy.Rules [2 ].Name | Should - Be " Test3"
1929+ $policy.Rules [2 ].Enabled | Should - Be $false
1930+ $policy.Rules [2 ].Definition.ObjectType | Should - Be Blob
1931+ $policy.Rules [2 ].Definition.Format | Should - Be Parquet
1932+ $policy.Rules [2 ].Definition.Schedule | Should - Be Daily
1933+ $policy.Rules [2 ].Definition.SchemaFields.Count | Should - Be 10
1934+ $policy.Rules [2 ].Definition.Filters.ExcludePrefix.Count | Should - Be 2
1935+ $policy.Rules [2 ].Definition.Filters.IncludeDeleted | Should - Be $true
1936+ $policy.Rules [2 ].Definition.Filters.IncludeBlobVersions | Should - Be $null
1937+ $policy.Rules [2 ].Definition.Filters.IncludeSnapshots | Should - Be $null
18761938 $policy = $null
18771939
18781940 # policy pipeline
18791941 $policy = Get-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv | Set-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv
18801942 $policy.Enabled | should - Be $true
1881- $policy.Rules.Count | should - be 2
1943+ $policy.Rules.Count | should - be 3
18821944 $policy.Rules [0 ].Name | should - be " Test1"
18831945 $policy.Rules [0 ].Enabled | should - Be $true
18841946 $policy.Rules [0 ].Destination | should - Be $containerName
@@ -1901,10 +1963,20 @@ Describe "Management plan test" {
19011963 $policy.Rules [1 ].Definition.Filters.IncludeSnapshots | should - Be $null
19021964 $policy.Rules [1 ].Definition.Filters.BlobTypes| should - be $null
19031965 $policy.Rules [1 ].Definition.Filters.PrefixMatch.Count | should - be 2
1966+ $policy.Rules [2 ].Name | Should - Be " Test3"
1967+ $policy.Rules [2 ].Enabled | Should - Be $false
1968+ $policy.Rules [2 ].Definition.ObjectType | Should - Be Blob
1969+ $policy.Rules [2 ].Definition.Format | Should - Be Parquet
1970+ $policy.Rules [2 ].Definition.Schedule | Should - Be Daily
1971+ $policy.Rules [2 ].Definition.SchemaFields.Count | Should - Be 10
1972+ $policy.Rules [2 ].Definition.Filters.ExcludePrefix.Count | Should - Be 2
1973+ $policy.Rules [2 ].Definition.Filters.IncludeDeleted | Should - Be $true
1974+ $policy.Rules [2 ].Definition.Filters.IncludeBlobVersions | Should - Be $null
1975+ $policy.Rules [2 ].Definition.Filters.IncludeSnapshots | Should - Be $null
19041976 $policy = $null
19051977 $policy = , ((Get-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv ).Rules) | Set-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv - Disabled
19061978 $policy.Enabled | should - Be $false
1907- $policy.Rules.Count | should - be 2
1979+ $policy.Rules.Count | should - be 3
19081980 $policy.Rules [0 ].Name | should - be " Test1"
19091981 $policy.Rules [0 ].Enabled | should - Be $true
19101982 $policy.Rules [0 ].Destination | should - Be $containerName
@@ -1927,6 +1999,16 @@ Describe "Management plan test" {
19271999 $policy.Rules [1 ].Definition.Filters.IncludeSnapshots | should - Be $null
19282000 $policy.Rules [1 ].Definition.Filters.BlobTypes| should - be $null
19292001 $policy.Rules [1 ].Definition.Filters.PrefixMatch.Count | should - be 2
2002+ $policy.Rules [2 ].Name | Should - Be " Test3"
2003+ $policy.Rules [2 ].Enabled | Should - Be $false
2004+ $policy.Rules [2 ].Definition.ObjectType | Should - Be Blob
2005+ $policy.Rules [2 ].Definition.Format | Should - Be Parquet
2006+ $policy.Rules [2 ].Definition.Schedule | Should - Be Daily
2007+ $policy.Rules [2 ].Definition.SchemaFields.Count | Should - Be 10
2008+ $policy.Rules [2 ].Definition.Filters.ExcludePrefix.Count | Should - Be 2
2009+ $policy.Rules [2 ].Definition.Filters.IncludeDeleted | Should - Be $true
2010+ $policy.Rules [2 ].Definition.Filters.IncludeBlobVersions | Should - Be $null
2011+ $policy.Rules [2 ].Definition.Filters.IncludeSnapshots | Should - Be $null
19302012 $policy = $null
19312013 Get-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv | Remove-AzStorageBlobInventoryPolicy
19322014
0 commit comments