-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Detach managed hsm from key vault command #13187
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
Merged
Yeming Liu (isra-fel)
merged 8 commits into
Azure:bez/managedHsm
from
BethanyZhou:detachMhsmFromKv
Oct 15, 2020
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
65b9a87
get managed hsm
BethanyZhou 1831ef9
new managed hsm
BethanyZhou dacef85
remove managed hsm
BethanyZhou 88c720e
update help.md
BethanyZhou e946168
update managed hsm
BethanyZhou 6268fa3
add online version for new help.md
BethanyZhou 67529a7
Convert mhsm test to liveonly
BethanyZhou bdf80d7
add test record
BethanyZhou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using System.Management.Automation; | ||
| using Microsoft.Azure.Commands.KeyVault.Models; | ||
| using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; | ||
|
|
||
| namespace Microsoft.Azure.Commands.KeyVault.Commands | ||
| { | ||
| [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ManagedHsm")] | ||
| [OutputType(typeof(PSManagedHsm), typeof(PSKeyVaultIdentityItem))] | ||
| public class GetAzureManagedHsm : KeyVaultManagementCmdletBase | ||
| { | ||
| #region Input Parameter Definitions | ||
|
|
||
| /// <summary> | ||
| /// Hsm name | ||
| /// </summary> | ||
| [Parameter(Mandatory = false, | ||
| Position = 0, | ||
| ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Hsm name. Cmdlet constructs the FQDN of a hsm based on the name and currently selected environment.")] | ||
| [ResourceNameCompleter("Microsoft.KeyVault/managedHSMs", "ResourceGroupName")] | ||
| [Alias(Constants.Name)] | ||
| [ValidateNotNullOrEmpty] | ||
| [SupportsWildcards] | ||
| public string HsmName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Resource group name | ||
| /// </summary> | ||
| [Parameter(Mandatory = false, | ||
| Position = 1, | ||
| ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specifies the name of the resource group associated with the managed hsm being queried.")] | ||
| [ResourceGroupCompleter] | ||
| [ValidateNotNullOrEmpty] | ||
| [SupportsWildcards] | ||
| public string ResourceGroupName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Tag value | ||
| /// </summary> | ||
| [Parameter( | ||
| Mandatory = false, | ||
| ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specifies the key and optional value of the specified tag to filter the list of managed hsms by.")] | ||
| public Hashtable Tag { get; set; } | ||
|
|
||
| #endregion | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(HsmName, true) : ResourceGroupName; | ||
|
|
||
| if (ShouldGetByName(ResourceGroupName, HsmName)) | ||
| { | ||
| PSManagedHsm mhsm = KeyVaultManagementClient.GetManagedHsm( | ||
| HsmName, | ||
| ResourceGroupName, | ||
| ActiveDirectoryClient); | ||
| WriteObject(FilterByTag(mhsm, Tag)); | ||
| } | ||
| else | ||
| { | ||
| WriteObject( | ||
| TopLevelWildcardFilter( | ||
| ResourceGroupName, HsmName, | ||
| FilterByTag( | ||
| KeyVaultManagementClient.ListManagedHsms(ResourceGroupName, ActiveDirectoryClient), Tag)), | ||
| true); | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.