@@ -731,44 +731,44 @@ function Test-StorageBlobORS
731731 $stoname1 = ' sto' + $rgname + ' src' ;
732732 $stoname2 = ' sto' + $rgname + ' dest' ;
733733 $stotype = ' Standard_LRS' ;
734- $loc = Get-ProviderLocation_Canary ResourceManagement;
734+ $loc = Get-ProviderLocation ResourceManagement;
735735 $kind = ' StorageV2'
736736
737737 Write-Verbose " RGName: $rgname | Loc: $loc "
738738 New-AzResourceGroup - Name $rgname - Location $loc ;
739739
740- $loc = Get-ProviderLocation_Canary ResourceManagement;
740+ $loc = Get-ProviderLocation ResourceManagement;
741741 $sto1 = New-AzStorageAccount - ResourceGroupName $rgname - Name $stoname1 - Location $loc - Type $stotype - Kind $kind
742742 $sto2 = New-AzStorageAccount - ResourceGroupName $rgname - Name $stoname2 - Location $loc - Type $stotype - Kind $kind
743- Assert-Null $sto1.AllowCrossTenantReplication
744- Assert-Null $sto2.AllowCrossTenantReplication
743+ Assert-AreEqual $false $sto1.AllowCrossTenantReplication
744+ Assert-AreEqual $false $sto2.AllowCrossTenantReplication
745745
746- # Enable Blob Enable Changefeed and versioning
747- Update-AzStorageBlobServiceProperty - ResourceGroupName $rgname - StorageAccountName $stoname1 - EnableChangeFeed $true - IsVersioningEnabled $true
748- Update-AzStorageBlobServiceProperty - ResourceGroupName $rgname - StorageAccountName $stoname2 - EnableChangeFeed $true - IsVersioningEnabled $true
749- $property1 = Get-AzStorageBlobServiceProperty - ResourceGroupName $rgname - StorageAccountName $stoname1
750- Assert-AreEqual $true $property1.ChangeFeed.Enabled
751- Assert-AreEqual $true $property1.IsVersioningEnabled
752- $property2 = Get-AzStorageBlobServiceProperty - ResourceGroupName $rgname - StorageAccountName $stoname2
753- Assert-AreEqual $true $property2.ChangeFeed.Enabled
754- Assert-AreEqual $true $property2.IsVersioningEnabled
755-
756- # create containers
757- Get-AzStorageAccount - ResourceGroupName $rgname - StorageAccountName $stoname1 | New-AzRmStorageContainer - name src
758- Get-AzStorageAccount - ResourceGroupName $rgname - StorageAccountName $stoname2 | New-AzRmStorageContainer - name dest
759- Get-AzStorageAccount - ResourceGroupName $rgname - StorageAccountName $stoname1 | New-AzRmStorageContainer - name src1
746+ # Enable Blob Enable Changefeed and versioning
747+ Update-AzStorageBlobServiceProperty - ResourceGroupName $rgname - StorageAccountName $stoname1 - EnableChangeFeed $true - IsVersioningEnabled $true
748+ Update-AzStorageBlobServiceProperty - ResourceGroupName $rgname - StorageAccountName $stoname2 - EnableChangeFeed $true - IsVersioningEnabled $true
749+ $property1 = Get-AzStorageBlobServiceProperty - ResourceGroupName $rgname - StorageAccountName $stoname1
750+ Assert-AreEqual $true $property1.ChangeFeed.Enabled
751+ Assert-AreEqual $true $property1.IsVersioningEnabled
752+ $property2 = Get-AzStorageBlobServiceProperty - ResourceGroupName $rgname - StorageAccountName $stoname2
753+ Assert-AreEqual $true $property2.ChangeFeed.Enabled
754+ Assert-AreEqual $true $property2.IsVersioningEnabled
755+
756+ # create containers
757+ Get-AzStorageAccount - ResourceGroupName $rgname - StorageAccountName $stoname1 | New-AzRmStorageContainer - name src
758+ Get-AzStorageAccount - ResourceGroupName $rgname - StorageAccountName $stoname2 | New-AzRmStorageContainer - name dest
759+ Get-AzStorageAccount - ResourceGroupName $rgname - StorageAccountName $stoname1 | New-AzRmStorageContainer - name src1
760760 Get-AzStorageAccount - ResourceGroupName $rgname - StorageAccountName $stoname2 | New-AzRmStorageContainer - name dest1
761-
761+
762762 # create rules
763763 $minCreationTime = " 2019-01-01T16:00:00Z"
764764 $rule1 = New-AzStorageObjectReplicationPolicyRule - SourceContainer src1 - DestinationContainer dest1
765765 $rule2 = New-AzStorageObjectReplicationPolicyRule - SourceContainer src - DestinationContainer dest - MinCreationTime $minCreationTime - PrefixMatch a, abc, dd # -Tag t1,t2,t3
766766
767- # set policy to dest account
768- $destPolicy = Set-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname2 - PolicyId default - SourceAccount $stoname1 - Rule $rule1 , $rule2
769- $policyID = $destPolicy.PolicyId
770- Assert-AreEqual $stoname1 $destPolicy.SourceAccount
771- Assert-AreEqual $stoname2 $destPolicy.DestinationAccount
767+ # set policy to dest account
768+ $destPolicy = Set-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname2 - PolicyId default - SourceAccount $sto1 .Id - Rule $rule1 , $rule2 - EnableMetric $true
769+ $policyID = $destPolicy.PolicyId
770+ Assert-AreEqual $sto1 .Id $destPolicy.SourceAccount
771+ Assert-AreEqual $sto2 .Id $destPolicy.DestinationAccount
772772 Assert-AreEqual 2 $destPolicy.Rules.Count
773773 Assert-AreEqual src1 $destPolicy.Rules [0 ].SourceContainer
774774 Assert-AreEqual dest1 $destPolicy.Rules [0 ].DestinationContainer
@@ -779,8 +779,8 @@ function Test-StorageBlobORS
779779 Assert-AreEqual $minCreationTime ($destPolicy.Rules [1 ].Filters.MinCreationTime.ToUniversalTime().ToString(" s" )+ " Z" )
780780 $destPolicy = Get-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname2 - PolicyId $destPolicy.PolicyId
781781 Assert-AreEqual $policyID $destPolicy.PolicyId
782- Assert-AreEqual $stoname1 $destPolicy.SourceAccount
783- Assert-AreEqual $stoname2 $destPolicy.DestinationAccount
782+ Assert-AreEqual $sto1 .Id $destPolicy.SourceAccount
783+ Assert-AreEqual $sto2 .Id $destPolicy.DestinationAccount
784784 Assert-AreEqual 2 $destPolicy.Rules.Count
785785 Assert-AreEqual src1 $destPolicy.Rules [0 ].SourceContainer
786786 Assert-AreEqual dest1 $destPolicy.Rules [0 ].DestinationContainer
@@ -789,13 +789,14 @@ function Test-StorageBlobORS
789789 Assert-AreEqual dest $destPolicy.Rules [1 ].DestinationContainer
790790 Assert-AreEqual 3 $destPolicy.Rules [1 ].Filters.PrefixMatch.Count
791791 Assert-AreEqual $minCreationTime ($destPolicy.Rules [1 ].Filters.MinCreationTime.ToUniversalTime().ToString(" s" )+ " Z" )
792+ Assert-AreEqual $true $destPolicy.Metrics.Enabled
792793
793794 # Set policy to source account
794795 Set-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname1 - InputObject $destPolicy
795796 $srcPolicy = Get-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname1
796797 Assert-AreEqual $policyID $srcPolicy.PolicyId
797- Assert-AreEqual $stoname1 $srcPolicy .SourceAccount
798- Assert-AreEqual $stoname2 $srcPolicy .DestinationAccount
798+ Assert-AreEqual $sto1 .Id $destPolicy .SourceAccount
799+ Assert-AreEqual $sto2 .Id $destPolicy .DestinationAccount
799800 Assert-AreEqual 2 $srcPolicy.Rules.Count
800801 Assert-AreEqual src1 $srcPolicy.Rules [0 ].SourceContainer
801802 Assert-AreEqual dest1 $srcPolicy.Rules [0 ].DestinationContainer
@@ -804,6 +805,7 @@ function Test-StorageBlobORS
804805 Assert-AreEqual dest $srcPolicy.Rules [1 ].DestinationContainer
805806 Assert-AreEqual 3 $srcPolicy.Rules [1 ].Filters.PrefixMatch.Count
806807 Assert-AreEqual $minCreationTime ($srcPolicy.Rules [1 ].Filters.MinCreationTime.ToUniversalTime().ToString(" s" )+ " Z" )
808+ Assert-AreEqual $true $srcPolicy.Metrics.Enabled
807809 $destPolicy | Remove-AzStorageObjectReplicationPolicy
808810 $srcPolicy | Remove-AzStorageObjectReplicationPolicy
809811
@@ -814,7 +816,7 @@ function Test-StorageBlobORS
814816 Assert-AreEqual $false $sto2.AllowCrossTenantReplication
815817
816818 # Set policy with source account resourceID
817- Set-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname2 - PolicyId default - SourceAccount $sto1.Id - Rule $rule1 , $rule2
819+ Set-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname2 - PolicyId default - SourceAccount $sto1.Id - Rule $rule1 , $rule2 - EnableMetric $false
818820 $destPolicy = Get-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname2
819821 $policyID = $destPolicy.PolicyId
820822 Assert-AreEqual $sto1.Id $destPolicy.SourceAccount
@@ -827,6 +829,7 @@ function Test-StorageBlobORS
827829 Assert-AreEqual dest $destPolicy.Rules [1 ].DestinationContainer
828830 Assert-AreEqual 3 $destPolicy.Rules [1 ].Filters.PrefixMatch.Count
829831 Assert-AreEqual $minCreationTime ($destPolicy.Rules [1 ].Filters.MinCreationTime.ToUniversalTime().ToString(" s" )+ " Z" )
832+ Assert-AreEqual $false $destPolicy.Metrics.Enabled
830833
831834 Set-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname1 - InputObject $destPolicy
832835 $srcPolicy = Get-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname1
@@ -841,13 +844,14 @@ function Test-StorageBlobORS
841844 Assert-AreEqual dest $srcPolicy.Rules [1 ].DestinationContainer
842845 Assert-AreEqual 3 $srcPolicy.Rules [1 ].Filters.PrefixMatch.Count
843846 Assert-AreEqual $minCreationTime ($srcPolicy.Rules [1 ].Filters.MinCreationTime.ToUniversalTime().ToString(" s" )+ " Z" )
847+ Assert-AreEqual $false $srcPolicy.Metrics.Enabled
844848
845849 # remove policies
846850 Remove-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname2 - PolicyId $destPolicy.PolicyId
847851 Remove-AzStorageObjectReplicationPolicy - ResourceGroupName $rgname - StorageAccountName $stoname1 - PolicyId $srcPolicy.PolicyId
848-
849- Remove-AzStorageAccount - Force - ResourceGroupName $rgname - Name $stoname1 ;
850- Remove-AzStorageAccount - Force - ResourceGroupName $rgname - Name $stoname2 ;
852+
853+ Remove-AzStorageAccount - Force - ResourceGroupName $rgname - Name $stoname1 ;
854+ Remove-AzStorageAccount - Force - ResourceGroupName $rgname - Name $stoname2 ;
851855 }
852856 finally
853857 {
0 commit comments