Skip to content

[Az.RecoveryServices.Backup] Customer Managed Key Encryption for recovery services vault#13593

Merged
dolauli merged 2 commits intoAzure:release-2020-12-29from
MabOneSdk:hiaga/CMK
Dec 24, 2020
Merged

[Az.RecoveryServices.Backup] Customer Managed Key Encryption for recovery services vault#13593
dolauli merged 2 commits intoAzure:release-2020-12-29from
MabOneSdk:hiaga/CMK

Conversation

@hiaga
Copy link
Copy Markdown
Member

@hiaga hiaga commented Nov 26, 2020

Description

CMK for V1 vaults

Checklist

  • [Yes] I have read the Submitting Changes section of CONTRIBUTING.md
  • [Yes] The title of the PR is clear and informative
  • [Yes] The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • [Yes] The PR does not introduce breaking changes
  • [N/A] If applicable, the changes made in the PR have proper test coverage
  • [Yes] For public API changes to cmdlets:

@hiaga hiaga self-assigned this Nov 26, 2020
@hiaga hiaga force-pushed the hiaga/CMK branch 5 times, most recently from 1f3b2d8 to 60b4dbd Compare December 21, 2020 08:54
@hiaga hiaga changed the title [Do Not Merge] [Az.RecoveryServices] Customer Managed Key Encryption for V1 vaults [Az.RecoveryServices.Backup] Customer Managed Key Encryption for recovery services vault Dec 21, 2020
@hiaga hiaga assigned isra-fel and wyunchi-ms and unassigned hiaga Dec 21, 2020
@hiaga hiaga force-pushed the hiaga/CMK branch 3 times, most recently from 8efd182 to deaca5d Compare December 22, 2020 01:39
@hiaga
Copy link
Copy Markdown
Member Author

hiaga commented Dec 22, 2020

@isra-fel : can you pls merge the cmdlet review PR - https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/793

@isra-fel isra-fel changed the base branch from master to release-2020-12-29 December 22, 2020 09:26
@hiaga hiaga force-pushed the hiaga/CMK branch 3 times, most recently from 8c7fe5d to 8833168 Compare December 23, 2020 04:54
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For such long sleep, we suggest check if it's in a playback test and skip sleep if so. This could save you some time when playback tests.

For example
https://github.com/Azure/azure-powershell/blob/master/src/Accounts/Authentication/Factories/CancelRetryHandler.cs#L66

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a sample output here, for example

Suggested change
PS C:\> $vault.Identity
PS C:\> $vault.Identity
IdentityType: SystemAssigned
ObjectId: xxx

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked about specifying the key by vault name + key name + (optional) key version, which should be a third parameter set. But it's OK if you choose to add that in the next sprint

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are interested in first trying it this way, we can add it next CMK update. Also we aren't sure of hardcoding the Key url because it might use different format in service. is there a way we can construct the exact key.Id with these three values?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's basically $"https://{KeyVaultName}.{KeyVaultDnsSuffix}/keys/{key-name}" with optional "/{key-version}" at the end.

You can get {KeyVaultDnsSuffix} by DefaultContext.Environment.GetEndpoint(AzureEnvironment.Endpoint.AzureKeyVaultDnsSuffix)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great we would want to add this parameter set later.

fixing static analysis

fixing casing

skipping tests for upcoming release

resolving review comments
@hiaga
Copy link
Copy Markdown
Member Author

hiaga commented Dec 23, 2020

@isra-fel: added the changes. pls review.


// sleep for 30 seconds before checking again
TestMockSupport.Delay(30 * 1000);
string testMode = Environment.GetEnvironmentVariable("AZURE_TEST_MODE");
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isra-fel added this check to skip waiting in case Playback mode. seems like tests are still stuck. can you pls let me know the environment variable for /azp and the value it takes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I was wrong. We didn't set a envrionment when running tests. However there's a static field TestMockSupport.RunningMocked you can check.

In fact, I don't know why you change all the TestMockSupport.Delay() , that should work perfectly fine here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides, not only here, but all the "System.Threading.Sleep()should be wrapped in anIf` clause, otherwise the tests will still time out

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isra-fel : included "TestMockSupport.RunningMocked" and skipped two failed tests for now. I changed TestMockSupport.Delay() to Thread.Sleep() because while running the tests in record mode this was not putting a delay and was flooding our service with many calls. However it was working fine while running the cmdlets.

@isra-fel
Copy link
Copy Markdown
Member

Also, I tried to run the tests locally, there seem to be 2 cases still failling, needing to be recorded.

TestAzureVMSetVaultProperty in RecoveryServices.Backup.Test/ScenarioTests/IaasVm/ItemTests.cs
TestRecoveryServicesVaultCRUD in RecoveryServices.Test/ScenarioTests/RecoveryServicesTests.cs

Please either record them or skip.

@isra-fel
Copy link
Copy Markdown
Member

/azp run azure-powershell - powershell-core

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@isra-fel
Copy link
Copy Markdown
Member

CI stuck at generation test on MacOS. Last run was sucessful. It's OK to force merge.

@dolauli dolauli merged commit 4a33f21 into Azure:release-2020-12-29 Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants