-
Notifications
You must be signed in to change notification settings - Fork 4k
Azure Site Recovery support for managed Managed disk and Service Api Version bumpup changes #6905
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
Conversation
Cmdlet Review link :: https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/30 |
2d8e601
to
facf08f
Compare
facf08f
to
6269e1b
Compare
@@ -0,0 +1,142 @@ | |||
function Get-AzureRmResourceGroup |
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.
Why do you need to create your own AzureRM.Resources.ps1? Also, since the filename is 'AzureRm.Resources.ps1' and not 'AzureRM.Resources.ps1', this will cause issues in NetStandard as Linux files are case-sensitive.
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.
AzureRM.Resources.ps1 is for doing operation which is not part ASR , but we need to do for infrastructure creation for Azure to Azure replication.
If I am not creating it what is the other way out ?
'AzureRm.Resources.ps1' and not 'AzureRM.Resources.ps1' fixing this.
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 A similar file to this is already being included with your project. This file comes from our azure-powershell-common repo. It is included here:
azure-powershell/tools/Common.Dependencies.Test.targets
Lines 78 to 80 in c2765af
<None Include="$(ScenarioTestToolsPath)AzureRM.Resources.ps1"> | |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
</None> |
That should cover your needs as long as you are using our common ResourceManager project. We don't suggest using Microsoft.Azure.Management.Resources
anymore. You can see the entire file here: https://github.com/Azure/azure-powershell-common/blob/develop/src/ScenarioTest.ResourceManager/AzureRM.Resources.ps1
@@ -34,12 +34,31 @@ | |||
<WarningLevel>4</WarningLevel> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<Reference Include="Hyak.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> |
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.
Do not add duplicate references. Most of these added references exist in our Common.Dependences.targets or Common.Dependencies.Test.targets file. In Visual Studio in the Solution Explorer, you'll see several references duplicated, one resolved properly and one with a yellow exclamation mark. Please remove the duplicate references.
Write-Host $("Job Status:") -ForegroundColor Green | ||
$Job | ||
|
||
if($Job.State -eq "InProgress" -or $Job.State -eq "NotStarted") |
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.
If statements require boolean conditions. So, assigning a boolean based on a boolean is redundant. It can simply be:
$isJobLeftForProcessing = ($Job.State -eq 'InProgress' -or $Job.State -eq 'NotStarted')
Also, double quotes are used for interpolated strings (strings that can substitute variables in-place) where single quotes are used for string literals.
do | ||
{ | ||
$IRjobs = Get-AzureRmRecoveryServicesAsrJob -TargetObjectId $affectedObjectId | Sort-Object StartTime -Descending | select -First 2 | Where-Object{$_.JobType -eq "SecondaryIrCompletion"} | ||
if($IRjobs -eq $null -or $IRjobs.Count -ne 1) |
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.
Same as above.
this.helper.SetupEnvironment(AzureModule.AzureResourceManager); | ||
|
||
var rmProfileModule = this.helper.RMProfileModule; | ||
var modules = new List<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.
Why not simply declare an array with the values already initialized? No need to dynamically add values and then convert it to an array.
@@ -0,0 +1,76 @@ | |||
// ---------------------------------------------------------------------------------- |
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 is a space in this filename. Please name the file PSComputeClient.cs
.
|
||
var hyperVReplicaAzurePolicyInput = new HyperVReplicaAzurePolicyInput | ||
{ | ||
ApplicationConsistentSnapshotFrequencyInHours = | ||
this.applicationConsistentSnapshotFrequencyInHours, | ||
Encryption = this.encryption, | ||
// encryption is removed from latest API . Service is setting the default vault internally. |
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.
Was Encryption
exposed to the PowerShell user? Is this a breaking change?
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 field should have been already deprecated in older PowerShell and older API versions. (Service stopped honouring this field for several months already). This PR contains changes that use new api-version for APIs.
@viverm is this field no longer available in new api? Is this why this is removed?
In case this is a concern, one option I'm thinking continue to have PS parameter, but default to whatever value service is already having in implementation.
I think probably we just need to remove the comment as well. Encryption has been not honoured in service for an year now.
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.
we cann't remove it from cmdlet but as service is not taking that input anymore , we are not populating it.
It is not the breaking change as service was not honoring it earlier . @MiYanni
<package id="Microsoft.Azure.Management.RecoveryServices.SiteRecovery" version="1.0.3-preview" targetFramework="net452" /> | ||
</packages> | ||
<package id="Microsoft.Azure.Management.RecoveryServices.SiteRecovery" version="1.2.0-preview" targetFramework="net452" /> | ||
<package id="Microsoft.Rest.ClientRuntime" version="2.3.11" targetFramework="net452" /> |
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.
The ClientRuntime packages are handed by the Common.Dependencies.targets and Profile's packages.config respectively. These will not be used.
@@ -1,12 +1,15 @@ | |||
Microsoft Visual Studio Solution File, Format Version 12.00 | |||
# Visual Studio 15 | |||
VisualStudioVersion = 15.0.27703.2042 | |||
VisualStudioVersion = 15.0.26430.13 | |||
MinimumVisualStudioVersion = 10.0.40219.1 | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{95C16AED-FD57-42A0-86C3-2CF4300A4817}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RecoveryServices.SiteRecovery", "Commands.RecoveryServices.SiteRecovery\Commands.RecoveryServices.SiteRecovery.csproj", "{7C879645-31EE-4A78-AD81-5512300FA105}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.RecoveryServices.SiteRecovery.Test", "Commands.RecoveryServices.SiteRecovery.Test\Commands.RecoveryServices.SiteRecovery.Test.csproj", "{6C7D3D81-37AB-445E-8081-78A1FEC0A774}" |
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 needs to be a project reference to Profile in this solution for it to load the Common.Dependencies.targets appropriately.
@@ -88,12 +88,6 @@ | |||
</None> | |||
<None Include="StartupScripts\*.ps1" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\..\Profile\Commands.Profile\Commands.Profile.csproj"> |
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.
Why was Profile removed?
@@ -16,3 +16,8 @@ | |||
"Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.dll","Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.GetAzureRmRecoveryServicesAsrStorageClassification","Get-AzureRmRecoveryServicesAsrStorageClassification","0","1020","The cmdlet 'Get-AzureRmRecoveryServicesAsrStorageClassification' no longer has output type 'System.Collections.Generic.IEnumerable`1[Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRStorageClassification]'.","Make cmdlet 'Get-AzureRmRecoveryServicesAsrStorageClassification' return type 'System.Collections.Generic.IEnumerable`1[Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRStorageClassification]'." | |||
"Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.dll","Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.GetAzureRmRecoveryServicesAsrStorageClassificationMapping","Get-AzureRmRecoveryServicesAsrStorageClassificationMapping","0","1020","The cmdlet 'Get-AzureRmRecoveryServicesAsrStorageClassificationMapping' no longer has output type 'System.Collections.Generic.IEnumerable`1[Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRStorageClassificationMapping]'.","Make cmdlet 'Get-AzureRmRecoveryServicesAsrStorageClassificationMapping' return type 'System.Collections.Generic.IEnumerable`1[Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRStorageClassificationMapping]'." | |||
"Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.dll","Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.GetAzureRmRecoveryServicesAsrvCenter","Get-AzureRmRecoveryServicesAsrvCenter","0","1020","The cmdlet 'Get-AzureRmRecoveryServicesAsrvCenter' no longer has output type 'System.Collections.Generic.IEnumerable`1[Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRvCenter]'.","Make cmdlet 'Get-AzureRmRecoveryServicesAsrvCenter' return type 'System.Collections.Generic.IEnumerable`1[Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRvCenter]'." | |||
"Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.dll","Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.StartAzureRmRecoveryServicesAsrSwitchProcessServerJob","Start-AzureRmRecoveryServicesAsrSwitchProcessServerJob","0","3010","The property 'ChildErrors' of type 'Microsoft.Azure.Management.RecoveryServices.SiteRecovery.Models.HealthError' has been removed.","Add the property 'ChildErrors' back to type 'Microsoft.Azure.Management.RecoveryServices.SiteRecovery.Models.HealthError'." |
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.
These all seem like actual breaking changes - you cannot ship breaking changes in this release.
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.
Properties added in breaking change is coming from API version bump up.
These properties are not used as input / output of powershell cmdlet
@viverm Looks like you will need to fix up this PR to pull in the the Netstandard changes. Also, looks like one of your tests is failing: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell/7133/artifact/src/Publish/TestResults/FailingTests/Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.Test.dll.html |
@maddieclayton resolved merge conflict and code changes done for test and netStandard. |
Assigning to @cormacpayne as he did the cmdlet design review. |
@@ -0,0 +1,142 @@ | |||
function Get-AzureRmResourceGroup |
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 A similar file to this is already being included with your project. This file comes from our azure-powershell-common repo. It is included here:
azure-powershell/tools/Common.Dependencies.Test.targets
Lines 78 to 80 in c2765af
<None Include="$(ScenarioTestToolsPath)AzureRM.Resources.ps1"> | |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
</None> |
That should cover your needs as long as you are using our common ResourceManager project. We don't suggest using Microsoft.Azure.Management.Resources
anymore. You can see the entire file here: https://github.com/Azure/azure-powershell-common/blob/develop/src/ScenarioTest.ResourceManager/AzureRM.Resources.ps1
$recoveryFabricName = getRecoveryFabric | ||
|
||
New-AzureRmResourceGroup -name $vaultRg -location $vaultRgLocation -force | ||
[Microsoft.Azure.Test.TestUtilities]::Wait(20 * 1000) |
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 be using [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait
[Microsoft.Azure.Test.TestUtilities]::Wait(20 * 1000) | ||
# vault Creation | ||
New-azureRmRecoveryServicesVault -ResourceGroupName $vaultRg -Name $vaultName -Location $vaultLocation | ||
[Microsoft.Azure.Test.TestUtilities]::Wait(20 * 1000) |
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 be using [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait
{ | ||
Write-Host $("IR in Progress...") -ForegroundColor Yellow | ||
Write-Host $("Waiting for: " + $JobQueryWaitTimeInSeconds.ToString + " Seconds") -ForegroundColor Yellow | ||
[Microsoft.Azure.Test.TestUtilities]::Wait($JobQueryWaitTimeInSeconds * 1000) |
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 be using [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait
Write-Host $($($Job.JobType) + " in Progress...") -ForegroundColor Yellow | ||
} | ||
Write-Host $("Waiting for: " + $JobQueryWaitTimeInSeconds.ToString + " Seconds") -ForegroundColor Yellow | ||
[Microsoft.Azure.Test.TestUtilities]::Wait($JobQueryWaitTimeInSeconds * 1000) |
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 be using [Microsoft.Rest.ClientRuntime.Azure.TestFramework.TestUtilities]::Wait
public RecoveryServicesClient RecoveryServicesMgmtClient { get; private set; } | ||
public SiteRecoveryManagementClient SiteRecoveryMgmtClient { get; private set; } | ||
|
||
public SubscriptionClient SubscriptionClient { get; private 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.
Same comment at the other test controller above. I don't believe this should be needed.
public SubscriptionClient SubscriptionClient { get; private set; } | ||
|
||
public ComputeManagementClient ComputeManagementClient { get; private set; } | ||
public Microsoft.Azure.Management.ResourceManager.ResourceManagementClient ResourceManagementRestClient { get; private 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.
Same comment at the other test controller above. This should use Microsoft.Azure.Management.Internal.Resources
.
[Cmdlet("Edit", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "RecoveryServicesAsrRecoveryPlan",DefaultParameterSetName = ASRParameterSets.AppendGroup,SupportsShouldProcess = true)] | ||
[Cmdlet( | ||
VerbsData.Edit, | ||
"AzureRmRecoveryServicesAsrRecoveryPlan", |
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.
Needs to be ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "RecoveryServicesAsrRecoveryPlan"
@@ -76,7 +76,7 @@ public override void ExecuteSiteRecoveryCmdlet() | |||
catch (CloudException ex) | |||
{ | |||
Logger.Instance.WriteWarning(ex.Message); | |||
throw new Exception(Resources.TryDownloadingVaultFile); | |||
// throw new Exception(Resources.TryDownloadingVaultFile); |
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.
Commented code. Please remove if intended to no longer throw. Also, why was this exception commented out?
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.
// code interanally handled the cloud exception thrown earlier.But still there are changes of other exception.
// suggesting alternate way to user to unblock if this command is failing.
@@ -56,7 +56,7 @@ Appends a group to existing Azure Site Recovery recovery plan and returns the in | |||
List of ASR replication protected items to be added to the recovery plan group in the recovery plan object. | |||
|
|||
```yaml | |||
Type: Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRReplicationProtectedItem[] | |||
Type: ASRReplicationProtectedItem[] |
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.
You'll have to regenerate all your help files. You forgot to add the -UseFullTypeName
switch. See the documentation here: https://github.com/Azure/azure-powershell/blob/preview/documentation/development-docs/help-generation.md#updating-a-single-markdown-file
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 is something new from what we are doing in the way to generate help file.
will do the changes follow this from now onwards
…nto asr_managedDisk
@MiYanni Addressed the comment . one thing if I want to test the AZ recoveryServices where can I get installer to test? |
@viverm There is no installer for Az. You install the built modules using Register-PSRepository. |
Breaking changes have been removed from the PR.
Description
Checklist
CONTRIBUTING.md
platyPS
module