-
Notifications
You must be signed in to change notification settings - Fork 4k
Azure Site Recovery new cmdlet to support Azure to Azure (A2A) replication #5533
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
Azure Site Recovery new cmdlet to support Azure to Azure (A2A) replication #5533
Conversation
@@ -97,13 +97,26 @@ Accept pipeline input: False | |||
Accept wildcard characters: False | |||
``` | |||
|
|||
### -DefaultProfile | |||
The credentials, account, tenant, and subscription used for communication with Azure.```yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viverm There is a platyPS bug that adds these ```yaml
endings. You'll need to move each down to a new line for the build to succeed.
Changes done . @MiYanni Please check. |
@azuresdkci Retest this please |
waiting for PR review |
'New-AzureRmRecoveryServicesAsrProtectionContainerMapping', | ||
'New-AzureRmRecoveryServicesAsrRecoveryPlan', | ||
'New-AzureRmRecoveryServicesAsrReplicationProtectedItem', | ||
'New-AzureRmRecoveryServicesAsrStorageClassificationMapping', | ||
'New-AzureRmRecoveryServicesAsrvCenter', | ||
'New-AzureToAzureDiskReplicationConfiguration', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs at least an "AzureRm" prefix
@@ -0,0 +1,14 @@ | |||
<ASRVaultCreds xmlns="http://schemas.datacontract.org/2004/07/Microsoft.Azure.Portal.RecoveryServices.Models.Common" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a security risk to have this in our public repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. ManagementCert is needed to access vault which is already removed from the file .
########################## Site Recovery Tests ############################# | ||
|
||
##Default Value ## | ||
$vaultName = "A2APowershellTest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use getAssetName for generating resource names and Get-Location for getting valid locations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not fixed.
$primaryFabricName = "a2aPrimaryFabric3" | ||
$recoveryFabricName = "a2aRecoveryFabric3" | ||
|
||
$PrimaryAzureNetworkId = "/subscriptions/7c943c1b-5122-4097-90c8-861411bdd574/resourceGroups/powershellTest/providers/Microsoft.Network/virtualNetworks/powershellTest-vnet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyone should be able to rerecord this test, which will not be possible if you are using hard coded subscription ids. You should build up and break down the test infrastructure each time the test is recorded rather than using existing infrastructure that people might not have access to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Azure Site Recovery works on existing resources .And it needs N number of preexisting resources setup for recovery . For other ASR scenerio rerecording thing will not be easy as Enterprise infra will be non-existing at time of reRecording. ASR cmdlet runs in context of vault and subscription which already is imported from vaultCredentials file. If someone is rerecording he should have prior knowledge of creating infra to rerun and he can pass infra details at starting of the Test PS file.
If we put the logic of infra creation in test it will be pretty complex.
Can discuss if there is easy to make this independent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of our tests need to be rerecordable by people outside of your team, so having hardcoded resource ids with a subscription that most people cannot access will not work. Is there a reason you can't create the resources and infrastructure at test time? We can have a meeting about this if necessary.
[Microsoft.Azure.Test.TestUtilities]::Wait($JobQueryWaitTimeInSeconds * 1000) | ||
}else | ||
{ | ||
if( !(($job.State -eq "Succeeded") -or ($job.State -eq "CompletedWithInformation"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it not be !($job.State -eq "CompletedWithInformation")?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two successful condition Succeeded and CompletedWithInformation . If the value is something else it should throw the error.
@@ -19,6 +19,13 @@ New-AzureRmRecoveryServicesAsrNetworkMapping -Name <String> -PrimaryNetwork <ASR | |||
[<CommonParameters>] | |||
``` | |||
|
|||
### AzureToAzure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an example for this new parameter set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -37,6 +37,13 @@ New-AzureRmRecoveryServicesAsrPolicy [-AzureToVMware] -Name <String> -RecoveryPo | |||
[<CommonParameters>] | |||
``` | |||
|
|||
### AzureToAzure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an example for this new parameter set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.
@@ -47,6 +47,15 @@ New-AzureRmRecoveryServicesAsrReplicationProtectedItem [-HyperVToAzure] -Protect | |||
[-Confirm] [<CommonParameters>] | |||
``` | |||
|
|||
### AzureToAzure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an example for this new parameter set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.
@@ -30,6 +30,14 @@ Update-AzureRmRecoveryServicesAsrPolicy [-VMwareToAzure] -InputObject <ASRPolicy | |||
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>] | |||
``` | |||
|
|||
### AzureToAzure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an example for this new parameter set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.
@@ -51,6 +51,25 @@ Update-AzureRmRecoveryServicesAsrProtectionDirection [-VmmToVmm] | |||
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>] | |||
``` | |||
|
|||
### AzureToAzure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an example for these new parameter sets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.
@viverm Sorry for the late review. Some comments for you to look at, I'll look again in more depth when the big issues are fixed. Please reassign to me when you have finished looking at these comments. |
…nto a2apowershell_preview
@maddieclayton Still fix for GetAssetName and hardcoding in test needs to be disscussed. |
…nto a2apowershell_preview
@cormacpayne done with changes scheduled the build https://azuresdkci.westus2.cloudapp.azure.com/job/powershell-demand/626/console |
@cormacpayne Few formatting changes in help files when generated with platyps 2.9. |
### Example 3 | ||
``` | ||
PS C:\>$job = New-AzureRmRecoveryServicesAsrReplicationProtectedItem -AzureToAzure -AzureToAzureDiskReplicationConfig disk1,disk2 -AzureVmId $vmId ` | ||
-Name <String> -RecoveryVmName "vmName" -ProtectionContainerMapping $pcmMapping ` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viverm nit: change <String>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS C:>$job = New-AzureRmRecoveryServicesAsrReplicationProtectedItem -AzureToAzure -AzureToAzureDiskReplicationConfig disk1,disk2 -AzureVmId $vmId -Name "a2aprotectedItem" -RecoveryVmName "vmName" -ProtectionContainerMapping $pcmMapping
-RecoveryResourceGroupId $recoveryResourceGroup
corrected
``` | ||
PS C:\> $disk1 = new-AzureToAzureDiskReplicationConfiguration -vhdUri $diskUri1 -RecoveryAzureStorageAccountId $recoveryAzureStorageAccountId -LogStorageAccountId $logStorageAccountId | ||
PS C:\> $disk2 = new-AzureToAzureDiskReplicationConfiguration -vhdUri $diskUri2 -RecoveryAzureStorageAccountId $recoveryAzureStorageAccountId -LogStorageAccountId $logStorageAccountId | ||
PS C:\> $enableDRjob = New-AzureRmRecoveryServicesAsrReplicationProtectedItem -AzureToAzure -AzureVmId $vmId -Name $rpiName -RecoveryCloudServiceId $recoveryCloudServiceId -ProtectionContainerMapping $pcm -RecoveryResourceGroupId $RecoveryResourceGroupId -AzureToAzureDiskReplicationConfiguration $disk1,$disk2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viverm same comment here about trailing backtick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cormacpayne these individual commands are in one line that why there is no backtick.
For the readability purpose breaking the in multiple line with backtick.
@cormacpayne I am not able to find generated msi file to run and verify the things manually. https://azuresdkci.westus2.cloudapp.azure.com/job/powershell-demand/638/ How can I generate/find it? |
@cormacpayne Build is failing after merge . Can you check. |
You can find the generated msi in the following sign job: https://azuresdkci.westus2.cloudapp.azure.com/job/ps-sign/267/ |
/// </summary> | ||
[Cmdlet(VerbsCommon.New, "AzureRmRecoveryServicesVault", SupportsShouldProcess = true), | ||
OutputType(typeof(ARSVault))] | ||
public class NewAzureRmRecoveryServicesVault : RecoveryServicesCmdletBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viverm ping on this comment. This file should be removed.
@@ -76,16 +72,24 @@ public override void ExecuteSiteRecoveryCmdlet() | |||
{ | |||
using (var powerShell = System.Management.Automation.PowerShell.Create()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@viverm this powershell
object isn't used anymore, so we should get rid of the using
that instantiates it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File name changed from NewAzureRMRecoveryServicesVault.cs to NewAzureRmRecoveryServicesVault.cs reindex ed it.
….cs with older case
Description
https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/2
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines