@@ -1334,13 +1334,31 @@ Describe "Management plan test" {
1334
1334
Get-AzStorageAccount - ResourceGroupName $rgname - Name $accountNameEncypScope | New-AzStorageEncryptionScope - EncryptionScopeName $scopename - KeyvaultEncryption - KeyUri $KeyUri
1335
1335
1336
1336
# 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
1340
1342
1341
1343
# 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
1344
1362
1345
1363
# Set to Disabled.
1346
1364
# ## Move the encryption scope to CMK by passing { 'properties': { 'state':'Disabled' } }
@@ -1710,11 +1728,11 @@ Describe "Management plan test" {
1710
1728
$rule2 = New-AzStorageBlobInventoryPolicyRule - Name Test2 - Destination $containerName - Format Parquet - Schedule Weekly - BlobType blockBlob - PrefixMatch aaa, bbb - BlobSchemaField name, Last- Modified, Metadata, LastAccessTime, AccessTierInferred # ,Tags
1711
1729
$rule3 = New-AzStorageBlobInventoryPolicyRule - Name Test3 - Destination $containerName - Format Parquet - Schedule Daily - IncludeSnapshot - BlobType blockBlob, appendBlob - PrefixMatch aaa, bbb `
1712
1730
- 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
1714
1732
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
1716
1734
$policy.Enabled | should - Be $false
1717
- $policy.Rules.Count | should - be 3
1735
+ $policy.Rules.Count | should - be 4
1718
1736
$policy.Rules [0 ].Name | should - be " Test1"
1719
1737
$policy.Rules [0 ].Enabled | should - Be $false
1720
1738
$policy.Rules [0 ].Destination | should - Be $containerName
@@ -1748,11 +1766,19 @@ Describe "Management plan test" {
1748
1766
$policy.Rules [2 ].Definition.Filters.IncludeSnapshots | should - Be $true
1749
1767
$policy.Rules [2 ].Definition.Filters.BlobTypes.Count | should - be 2
1750
1768
$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
1751
1777
$policy = $null
1752
1778
1753
1779
$policy = Get-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv
1754
1780
$policy.Enabled | should - Be $false
1755
- $policy.Rules.Count | should - be 3
1781
+ $policy.Rules.Count | should - be 4
1756
1782
$policy.Rules [0 ].Name | should - be " Test1"
1757
1783
$policy.Rules [0 ].Enabled | should - Be $false
1758
1784
$policy.Rules [0 ].Destination | should - Be $containerName
@@ -1786,6 +1812,14 @@ Describe "Management plan test" {
1786
1812
$policy.Rules [2 ].Definition.Filters.IncludeSnapshots | should - Be $true
1787
1813
$policy.Rules [2 ].Definition.Filters.BlobTypes.Count | should - be 2
1788
1814
$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
1789
1823
$policy = $null
1790
1824
1791
1825
$removeSuccess = Remove-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv - PassThru
@@ -1847,10 +1881,28 @@ Describe "Management plan test" {
1847
1881
PrefixMatch = @ (" conpre1" , " conpre2" );
1848
1882
})
1849
1883
})
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
+ )
1851
1903
})
1852
1904
$policy.Enabled | should - Be $true
1853
- $policy.Rules.Count | should - be 2
1905
+ $policy.Rules.Count | should - be 3
1854
1906
$policy.Rules [0 ].Name | should - be " Test1"
1855
1907
$policy.Rules [0 ].Enabled | should - Be $true
1856
1908
$policy.Rules [0 ].Destination | should - Be $containerName
@@ -1873,12 +1925,22 @@ Describe "Management plan test" {
1873
1925
$policy.Rules [1 ].Definition.Filters.IncludeSnapshots | should - Be $null
1874
1926
$policy.Rules [1 ].Definition.Filters.BlobTypes| should - be $null
1875
1927
$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
1876
1938
$policy = $null
1877
1939
1878
1940
# policy pipeline
1879
1941
$policy = Get-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv | Set-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv
1880
1942
$policy.Enabled | should - Be $true
1881
- $policy.Rules.Count | should - be 2
1943
+ $policy.Rules.Count | should - be 3
1882
1944
$policy.Rules [0 ].Name | should - be " Test1"
1883
1945
$policy.Rules [0 ].Enabled | should - Be $true
1884
1946
$policy.Rules [0 ].Destination | should - Be $containerName
@@ -1901,10 +1963,20 @@ Describe "Management plan test" {
1901
1963
$policy.Rules [1 ].Definition.Filters.IncludeSnapshots | should - Be $null
1902
1964
$policy.Rules [1 ].Definition.Filters.BlobTypes| should - be $null
1903
1965
$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
1904
1976
$policy = $null
1905
1977
$policy = , ((Get-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv ).Rules) | Set-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv - Disabled
1906
1978
$policy.Enabled | should - Be $false
1907
- $policy.Rules.Count | should - be 2
1979
+ $policy.Rules.Count | should - be 3
1908
1980
$policy.Rules [0 ].Name | should - be " Test1"
1909
1981
$policy.Rules [0 ].Enabled | should - Be $true
1910
1982
$policy.Rules [0 ].Destination | should - Be $containerName
@@ -1927,6 +1999,16 @@ Describe "Management plan test" {
1927
1999
$policy.Rules [1 ].Definition.Filters.IncludeSnapshots | should - Be $null
1928
2000
$policy.Rules [1 ].Definition.Filters.BlobTypes| should - be $null
1929
2001
$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
1930
2012
$policy = $null
1931
2013
Get-AzStorageBlobInventoryPolicy - ResourceGroupName $rgname - StorageAccountName $accountNameBlobInv | Remove-AzStorageBlobInventoryPolicy
1932
2014
0 commit comments