Skip to content
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

adding support for backing up and restoring of KeyVault secrets #3883

Merged
merged 6 commits into from
May 3, 2017

Conversation

dragav
Copy link
Contributor

@dragav dragav commented May 2, 2017

adding support for backing up and restoring of KeyVault secrets
revising KeyVault backup/restore cmdlets:
adding support for pipelining
allowing overwriting of dest file
using session data store for file operations

addressing CR feedback: using nameof, discarding redundant parameter set clauses
fix build break following merge
CR feedback and fixing build breaks from merging changes

Description


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

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

revising KeyVault backup/restore cmdlets:
    adding support for pipelining
    allowing overwriting of dest file
    using session data store for file operations

addressing CR feedback: using nameof, discarding redundant parameter set clauses

more CR feedback

addressing CR feedback: using nameof, discarding redundant parameter set clauses

fix build break following merge

CR feedback and fixing build breaks from merging changes

adding support for backing up and restoring of KeyVault secrets

addressing CR feedback: using nameof, discarding redundant parameter set clauses

addressing CR feedback: using nameof, discarding redundant parameter set clauses
@msftclas
Copy link

msftclas commented May 2, 2017

@dragav,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@dragav
Copy link
Contributor Author

dragav commented May 2, 2017

Previous PR

/// </summary>
[Parameter( Mandatory = false,
Position = 3,
ValueFromPipelineByPropertyName = true,
Copy link
Member

Choose a reason for hiding this comment

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

Should not get its value from the pipeline at all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was following the existing pattern. It looks like you're ok with the current shape of these changes, and so I'll address this with the next opportunity. I have another change in the .. pipeline (no pun intended) for the 5/10 release. Thanks.

Copy link
Member

Choose a reason for hiding this comment

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

yes, that is fine, this is not functionally significant

/// </summary>
[Parameter( Mandatory = false,
Position = 3,
ValueFromPipelineByPropertyName = true,
Copy link
Member

Choose a reason for hiding this comment

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

Should not get value from pipeline at all

Copy link
Member

Choose a reason for hiding this comment

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

same - ok to leave this for later change

Copy link
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

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

Need to update BrekingChangeIssues for any Breaking Changes in this PR

Copy link
Member

@markcowl markcowl left a comment

Choose a reason for hiding this comment

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

Also, need to add breaking change suppressions for your change to BackupAzureKeyVaultKey

using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties;

namespace Microsoft.Azure.Commands.KeyVault
{
/// <summary>
/// Requests that a backup of the specified key be downloaded and stored to a file
/// </summary>
/// <remarks>
/// The cmdlet returns the path of the newly created backup file.
/// </remarks>
[Cmdlet(VerbsData.Backup, "AzureKeyVaultKey",
SupportsShouldProcess = true,
HelpUri = Constants.KeyVaultHelpUri)]
Copy link
Member

Choose a reason for hiding this comment

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

Need to add a DefaultParameterSetName value, since you now have multiple parameter sets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed.

setting default parameters for Backup commands
@cormacpayne cormacpayne removed their assignment May 2, 2017
@cormacpayne
Copy link
Member

@dragav you will need to take the contents of src/Package/BreakingChangeIssues.csv in the Build Artifacts folder from the job associated with the latest commit and paste them into tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv so that they will be suppressed during the build

"Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.BackupAzureKeyVaultKey","Backup-AzureKeyVaultKey","0","2100","The parameter 'VaultName' in cmdlet 'Backup-AzureKeyVaultKey' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'."
"Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.BackupAzureKeyVaultKey","Backup-AzureKeyVaultKey","0","2100","The parameter 'Name' in cmdlet 'Backup-AzureKeyVaultKey' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'."
"Microsoft.Azure.Commands.MachineLearning.dll","Microsoft.Azure.Commands.MachineLearning.UpdateAzureMLWebService","Update-AzureRmMlWebService","0","3040","The generic type argument for 'property Parameters' has been changed from 'System.String' to 'Microsoft.Azure.Management.MachineLearning.WebServices.Models.WebServiceParameter'.","Change the generic type argument for 'property Parameters' back to 'System.String'."
Copy link
Member

Choose a reason for hiding this comment

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

This last entry is repeated, but we don't need to change it right now.

markcowl
markcowl previously approved these changes May 2, 2017
Removing duplicate value and extra lines
@markcowl
Copy link
Member

markcowl commented May 2, 2017

@azuresdkci test this please

@cormacpayne
Copy link
Member

@markcowl markcowl merged commit b28bfd4 into Azure:preview May 3, 2017
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