From d416e40b7ea77acbc1e055a82e98697ab4c9a6e3 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Wed, 21 Feb 2018 11:43:36 -0800 Subject: [PATCH 01/19] initial changes --- .../UnitTests/RemoveKeyVaultKeyTests.cs | 4 +- .../UnitTests/SetKeyVaultKeyAttributeTests.cs | 10 +- .../Commands.KeyVault.csproj | 17 +-- .../Commands/AddAzureKeyVaultCertificate.cs | 13 +- .../AddAzureKeyVaultCertificateContact.cs | 118 ++++++++++------ .../Commands/AddAzureKeyVaultKey.cs | 126 +++++++++--------- .../Commands/BackupAzureKeyVaultKey.cs | 2 +- .../GetAzureKeyVaultCertificateContact.cs | 6 +- .../GetAzureKeyVaultCertificateOperation.cs | 4 +- .../GetAzureKeyVaultCertificatePolicy.cs | 4 +- .../Commands/GetAzureKeyVaultKey.cs | 4 +- .../NewAzureKeyVaultCertificatePolicy.cs | 4 +- .../RemoveAzureKeyVaultCertificateContact.cs | 4 +- ...RemoveAzureKeyVaultCertificateOperation.cs | 4 +- .../Commands/RestoreAzureKeyVaultKey.cs | 2 +- .../SetAzureKeyVaultCertificateIssuer.cs | 2 +- .../SetAzureKeyVaultCertificatePolicy.cs | 10 +- .../Commands/SetAzureKeyVaultKeyAttribute.cs | 2 +- .../StopAzureKeyVaultCertificateOperation.cs | 4 +- .../Commands/UndoAzureKeyVaultKeyRemoval.cs | 4 +- .../Models/DeletedKeyBundle.cs | 2 +- .../Models/IKeyVaultDataServiceClient.cs | 12 +- .../Commands.KeyVault/Models/KeyBundle.cs | 6 +- .../Models/KeyIdentityItem.cs | 2 +- .../Models/KeyVaultDataServiceClient.cs | 24 ++-- ...act.cs => PSKeyVaultCertificateContact.cs} | 10 +- ...n.cs => PSKeyVaultCertificateOperation.cs} | 6 +- ...licy.cs => PSKeyVaultCertificatePolicy.cs} | 8 +- 28 files changed, 228 insertions(+), 186 deletions(-) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyVaultCertificateContact.cs => PSKeyVaultCertificateContact.cs} (78%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyVaultCertificateOperation.cs => PSKeyVaultCertificateOperation.cs} (91%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyVaultCertificatePolicy.cs => PSKeyVaultCertificatePolicy.cs} (98%) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs index bd4746eda3f7..7cecb31bbb9a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs @@ -89,7 +89,7 @@ public void CannotRemoveKeyWithoutShouldProcessOrForceConfirmationTest() // Should process but without force commandRuntimeMock.Setup(cr => cr.ShouldProcess(KeyName, It.IsAny())).Returns(true); - KeyBundle expected = null; + PSKeyBundle expected = null; cmdlet.Name = KeyName; cmdlet.PassThru = true; @@ -121,7 +121,7 @@ public void ErrorRemoveKeyWithPassThruTest() catch { } keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs index 4179f297b336..7bf2c9009d53 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs @@ -26,7 +26,7 @@ public class SetKeyVaultKeyAttributeTests : KeyVaultUnitTestBase private SetAzureKeyVaultKeyAttribute cmdlet; private KeyAttributes keyAttributes; private WebKey.JsonWebKey webKey; - private KeyBundle keyBundle; + private PSKeyBundle keyBundle; public SetKeyVaultKeyAttributeTests() { @@ -34,7 +34,7 @@ public SetKeyVaultKeyAttributeTests() keyAttributes = new KeyAttributes(true, DateTime.Now, DateTime.Now, null, null, null); webKey = new WebKey.JsonWebKey(); - keyBundle = new KeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName, Version = KeyVersion }; + keyBundle = new PSKeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName, Version = KeyVersion }; cmdlet = new SetAzureKeyVaultKeyAttribute() { @@ -56,7 +56,7 @@ public void CanSetKeyAttributeTest() // Mock the should process to return true commandRuntimeMock.Setup(cr => cr.ShouldProcess(KeyName, It.IsAny())).Returns(true); - KeyBundle expected = keyBundle; + PSKeyBundle expected = keyBundle; keyVaultClientMock.Setup(kv => kv.UpdateKey(VaultName, KeyName, string.Empty, It.Is(kt => kt.Enabled == keyAttributes.Enabled && kt.Expires == keyAttributes.Expires @@ -79,7 +79,7 @@ public void ErrorSetKeyTest() // Mock the should process to return true commandRuntimeMock.Setup(cr => cr.ShouldProcess(KeyName, It.IsAny())).Returns(true); - KeyBundle expected = keyBundle; + PSKeyBundle expected = keyBundle; keyVaultClientMock.Setup(kv => kv.UpdateKey(VaultName, KeyName, string.Empty, It.Is(kt => kt.Enabled == keyAttributes.Enabled && kt.Expires == keyAttributes.Expires @@ -96,7 +96,7 @@ public void ErrorSetKeyTest() // Assert keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj index e379b7ac7c38..fa40e46d3c50 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj @@ -105,11 +105,11 @@ - + - + - + @@ -229,13 +229,10 @@ - - - - + + + + \ No newline at end of file diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs index 2a116ff4c271..6a25c9136c2c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Add, CmdletNoun.AzureKeyVaultCertificate, SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificateOperation))] + [OutputType(typeof(PSKeyVaultCertificateOperation))] public class AddAzureKeyVaultCertificate : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -37,7 +37,7 @@ public class AddAzureKeyVaultCertificate : KeyVaultCmdletBase ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] - public string VaultName { get; set; } + public string VaultName { get; set; } /// /// Name @@ -53,11 +53,12 @@ public class AddAzureKeyVaultCertificate : KeyVaultCmdletBase /// /// CertificatePolicy /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipeline = true, Position = 2, HelpMessage = "Specifies the certificate policy.")] [ValidateNotNull] - public KeyVaultCertificatePolicy CertificatePolicy { get; set; } + public PSKeyVaultCertificatePolicy CertificatePolicy { get; set; } /// /// Certificate tags @@ -69,11 +70,11 @@ public class AddAzureKeyVaultCertificate : KeyVaultCmdletBase public Hashtable Tag { get; set; } #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { if (ShouldProcess(Name, Properties.Resources.AddCertificate)) { var certificateOperation = this.DataServiceClient.EnrollCertificate(VaultName, Name, CertificatePolicy == null ? null : CertificatePolicy.ToCertificatePolicy(), Tag == null ? null : Tag.ConvertToDictionary()); - var kvCertificateOperation = KeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); + var kvCertificateOperation = PSKeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); this.WriteObject(kvCertificateOperation); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs index c40653a1ca16..0e027e71efe0 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs @@ -14,6 +14,7 @@ using Microsoft.Azure.Commands.KeyVault.Models; using Microsoft.Azure.KeyVault.Models; +using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; using System; using System.Collections.Generic; using System.Globalization; @@ -27,14 +28,16 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsCommon.Add, CmdletNoun.AzureKeyVaultCertificateContact, SupportsShouldProcess = true, - DefaultParameterSetName = AddParameterSet, + DefaultParameterSetName = InteractiveParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List))] + [OutputType(typeof(List))] public class AddAzureKeyVaultCertificateContact : KeyVaultCmdletBase { #region Parameter Set Names - private const string AddParameterSet = "Add"; + private const string InteractiveParameterSet = "Interactive"; + private const string InputObjectParameterSet = "ByObject"; + private const string ResourceIdParameterSet = "ByResourceId"; #endregion @@ -42,75 +45,112 @@ public class AddAzureKeyVaultCertificateContact : KeyVaultCmdletBase /// VaultName /// [Parameter(Mandatory = true, - ParameterSetName = AddParameterSet, + ParameterSetName = InteractiveParameterSet, Position = 0, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } + /// + /// VaultObject + /// + [Parameter(Mandatory = true, + ParameterSetName = InputObjectParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "KeyVault object.")] + [ValidateNotNullOrEmpty] + [Alias("VaultObject")] + public PSVault InputObject { get; set; } + + /// + /// VaultId + /// + [Parameter(Mandatory = true, + ParameterSetName = ResourceIdParameterSet, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "KeyVault Resource Id.")] + [ValidateNotNullOrEmpty] + [Alias("VaultId")] + public string ResourceId { get; set; } + /// /// EmailAddress /// [Parameter(Mandatory = true, - ParameterSetName = AddParameterSet, Position = 1, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the email address of the contact.")] [ValidateNotNullOrEmpty] - public string EmailAddress { get; set; } + public string[] EmailAddress { get; set; } /// /// PassThru parameter /// - [Parameter(HelpMessage = "This cmdlet does not return an object by default. If this switch is specified, it returns the contact object.")] + [Parameter(HelpMessage = "If this parameter is specified, all contacts for this KeyVault are returned")] public SwitchParameter PassThru { get; set; } - protected override void ProcessRecord() + public override void ExecuteCmdlet() { - if (ShouldProcess(EmailAddress, Properties.Resources.AddCertificateContact)) + if (ParameterSetName.Equals(InputObjectParameterSet)) { - Contacts existingContacts; + VaultName = InputObject.VaultName.ToString(); + } - try - { - existingContacts = this.DataServiceClient.GetCertificateContacts(VaultName); - } - catch (KeyVaultErrorException exception) + if (ParameterSetName.Equals(ResourceIdParameterSet)) + { + var parsedResourceId = new ResourceIdentifier(ResourceId); + VaultName = parsedResourceId.ResourceName; + } + + foreach (String email in EmailAddress) + { + if (ShouldProcess(email, Properties.Resources.AddCertificateContact)) { - if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound) + Contacts existingContacts; + + try { - throw; + existingContacts = this.DataServiceClient.GetCertificateContacts(VaultName); } + catch (KeyVaultErrorException exception) + { + if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound) + { + throw; + } - existingContacts = null; - } + existingContacts = null; + } - List newContactList; + List newContactList; - if (existingContacts == null || - existingContacts.ContactList == null) - { - newContactList = new List(); - } - else - { - newContactList = new List(existingContacts.ContactList); - } + if (existingContacts == null || + existingContacts.ContactList == null) + { + newContactList = new List(); + } + else + { + newContactList = new List(existingContacts.ContactList); + } - if (newContactList.FindIndex( - contact => (string.Compare(contact.EmailAddress, EmailAddress, StringComparison.OrdinalIgnoreCase) == 0)) != -1) - { - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Provided email address '{0}' already exists.", EmailAddress)); - } + if (newContactList.FindIndex( + contact => (string.Compare(contact.EmailAddress, email, StringComparison.OrdinalIgnoreCase) == 0)) != -1) + { + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Provided email address '{0}' already exists.", email)); + } - newContactList.Add(new Contact { EmailAddress = EmailAddress }); + newContactList.Add(new Contact { EmailAddress = email }); - var resultantContacts = this.DataServiceClient.SetCertificateContacts(VaultName, new Contacts { ContactList = newContactList }); + var resultantContacts = this.DataServiceClient.SetCertificateContacts(VaultName, new Contacts { ContactList = newContactList }); - if (PassThru.IsPresent) - { - this.WriteObject(KeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts)); + if (PassThru.IsPresent) + { + this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts), true); + } } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs index de568fc53cee..94a9df35655b 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs @@ -14,6 +14,7 @@ using Microsoft.Azure.Commands.KeyVault.Models; using Microsoft.Azure.KeyVault.WebKey; +using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; using System; using System.Collections; using System.IO; @@ -35,16 +36,21 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsCommon.Add, "AzureKeyVaultKey", SupportsShouldProcess = true, - DefaultParameterSetName = CreateParameterSet, + DefaultParameterSetName = InteractiveCreateParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyBundle))] + [OutputType(typeof(PSKeyBundle))] public class AddAzureKeyVaultKey : KeyVaultCmdletBase { #region Parameter Set Names - private const string CreateParameterSet = "Create"; - private const string ImportParameterSet = "Import"; + private const string InteractiveCreateParameterSet = "InteractiveCreate"; + private const string InputObjectCreateParameterSet = "InputObjectCreate"; + private const string InteractiveImportParameterSet = "InteractiveImport"; + private const string InputObjectImportParameterSet = "InputObjectImport"; + + private const string HsmDestination = "HSM"; + private const string SoftwareDestination = "Software"; #endregion @@ -54,27 +60,36 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase /// Vault name /// [Parameter(Mandatory = true, - ParameterSetName = CreateParameterSet, + ParameterSetName = InteractiveCreateParameterSet, Position = 0, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [Parameter(Mandatory = true, - ParameterSetName = ImportParameterSet, + ParameterSetName = InteractiveImportParameterSet, Position = 0, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } + [Parameter(Mandatory = true, + ParameterSetName = InputObjectCreateParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "Vault object.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectImportParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "Vault object.")] + [ValidateNotNullOrEmpty] + [Alias("VaultObject")] + public PSVault InputObject { get; set; } + /// /// key name /// [Parameter(Mandatory = true, - ParameterSetName = CreateParameterSet, - Position = 1, - HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] - [Parameter(Mandatory = true, - ParameterSetName = ImportParameterSet, Position = 1, HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] [ValidateNotNullOrEmpty] @@ -88,7 +103,12 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase /// 2. pfx /// [Parameter(Mandatory = true, - ParameterSetName = ImportParameterSet, + Position = 2, + ParameterSetName = InteractiveImportParameterSet, + HelpMessage = "Path to the local file containing the key material to be imported.")] + [Parameter(Mandatory = true, + Position = 2, + ParameterSetName = InputObjectImportParameterSet, HelpMessage = "Path to the local file containing the key material to be imported.")] [ValidateNotNullOrEmpty] public string KeyFilePath { get; set; } @@ -98,7 +118,10 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase /// Required for pfx file /// [Parameter(Mandatory = false, - ParameterSetName = ImportParameterSet, + ParameterSetName = InteractiveImportParameterSet, + HelpMessage = "Password of the local file containing the key material to be imported.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectImportParameterSet, HelpMessage = "Password of the local file containing the key material to be imported.")] [ValidateNotNullOrEmpty] public SecureString KeyFilePassword { get; set; } @@ -107,10 +130,18 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase /// Destination of the key /// [Parameter(Mandatory = true, - ParameterSetName = CreateParameterSet, + Position = 2, + ParameterSetName = InteractiveCreateParameterSet, + HelpMessage = "Specifies whether to add the key as a software-protected key or an HSM-protected key in the Key Vault service. Valid values are: HSM and Software. ")] + [Parameter(Mandatory = true, + Position = 2, + ParameterSetName = InputObjectCreateParameterSet, + HelpMessage = "Specifies whether to add the key as a software-protected key or an HSM-protected key in the Key Vault service. Valid values are: HSM and Software. ")] + [Parameter(Mandatory = false, + ParameterSetName = InteractiveImportParameterSet, HelpMessage = "Specifies whether to add the key as a software-protected key or an HSM-protected key in the Key Vault service. Valid values are: HSM and Software. ")] [Parameter(Mandatory = false, - ParameterSetName = ImportParameterSet, + ParameterSetName = InputObjectImportParameterSet, HelpMessage = "Specifies whether to add the key as a software-protected key or an HSM-protected key in the Key Vault service. Valid values are: HSM and Software. ")] [ValidateSet(HsmDestination, SoftwareDestination)] public string Destination { get; set; } @@ -118,11 +149,7 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase /// /// Set key in disabled state if present /// - [Parameter(Mandatory = false, - ParameterSetName = CreateParameterSet, - HelpMessage = "Indicates that the key you are adding is set to an initial state of disabled. Any attempt to use the key will fail. Use this parameter if you are preloading keys that you intend to enable later.")] - [Parameter(Mandatory = false, - ParameterSetName = ImportParameterSet, + [Parameter(Mandatory = false, HelpMessage = "Indicates that the key you are adding is set to an initial state of disabled. Any attempt to use the key will fail. Use this parameter if you are preloading keys that you intend to enable later.")] public SwitchParameter Disable { get; set; } @@ -130,11 +157,6 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase /// Key operations /// [Parameter(Mandatory = false, - ParameterSetName = CreateParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "The operations that can be performed with the key. If not present, all operations can be performed.")] - [Parameter(Mandatory = false, - ParameterSetName = ImportParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "The operations that can be performed with the key. If not present, all operations can be performed.")] public string[] KeyOps { get; set; } @@ -143,39 +165,24 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase /// Key expires time in UTC time /// [Parameter(Mandatory = false, - ParameterSetName = CreateParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the expiration time of the key in UTC. If not specified, key will not expire.")] - [Parameter(Mandatory = false, - ParameterSetName = ImportParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the expiration time of the key in UTC. If not present, key will not expire.")] public DateTime? Expires { get; set; } /// /// The UTC time before which key can't be used /// [Parameter(Mandatory = false, - ParameterSetName = CreateParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "The UTC time before which the key can't be used. If not specified, there is no limitation.")] - [Parameter(Mandatory = false, - ParameterSetName = ImportParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "The UTC time before which the key can't be used. If not present, there is no limitation.")] public DateTime? NotBefore { get; set; } /// /// Key tags /// [Parameter(Mandatory = false, - ParameterSetName = CreateParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "A hashtable representing key tags.")] - [Parameter(Mandatory = false, - ParameterSetName = ImportParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "A hashtable representing key tags.")] [Alias(Constants.TagsAlias)] public Hashtable Tag { get; set; } @@ -185,34 +192,34 @@ public override void ExecuteCmdlet() { if (ShouldProcess(Name, Properties.Resources.AddKey)) { - Models.KeyBundle keyBundle; - switch (ParameterSetName) + PSKeyBundle keyBundle; + if (InputObject != null) + { + VaultName = InputObject.VaultName.ToString(); + } + + if (string.IsNullOrEmpty(KeyFilePath)) { - case CreateParameterSet: - keyBundle = this.DataServiceClient.CreateKey( + keyBundle = this.DataServiceClient.CreateKey( VaultName, Name, CreateKeyAttributes()); - break; - - case ImportParameterSet: - bool? importToHsm = null; - keyBundle = this.DataServiceClient.ImportKey( - VaultName, Name, - CreateKeyAttributes(), - CreateWebKeyFromFile(), - string.IsNullOrEmpty(Destination) ? importToHsm : HsmDestination.Equals(Destination, StringComparison.OrdinalIgnoreCase)); - break; - - default: - throw new ArgumentException(KeyVaultProperties.Resources.BadParameterSetName); + } + else + { + bool? importToHsm = null; + keyBundle = this.DataServiceClient.ImportKey( + VaultName, Name, + CreateKeyAttributes(), + CreateWebKeyFromFile(), + string.IsNullOrEmpty(Destination) ? importToHsm : HsmDestination.Equals(Destination, StringComparison.OrdinalIgnoreCase)); } this.WriteObject(keyBundle); } } - internal Models.KeyAttributes CreateKeyAttributes() + internal KeyAttributes CreateKeyAttributes() { string keyType = string.Empty; @@ -241,8 +248,5 @@ internal JsonWebKey CreateWebKeyFromFile() var converterChain = WebKeyConverterFactory.CreateConverterChain(); return converterChain.ConvertKeyFromFile(keyFile, KeyFilePassword); } - - private const string HsmDestination = "HSM"; - private const string SoftwareDestination = "Software"; } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs index 53ae04dbd3a9..2e3bffd76e63 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs @@ -66,7 +66,7 @@ public class BackupAzureKeyVaultKey : KeyVaultCmdletBase ValueFromPipelineByPropertyName = true, ParameterSetName = ByKeyObjectParameterSet, HelpMessage = "Key bundle to back up, pipelined in from the output of a retrieval call." )] - public KeyBundle Key { get; set; } + public PSKeyBundle Key { get; set; } /// /// Key name diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs index 6e39951356d9..c493617e5039 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, CmdletNoun.AzureKeyVaultCertificateContact, DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List))] + [OutputType(typeof(List))] public class GetAzureKeyVaultCertificateContact : KeyVaultCmdletBase { #region Parameter Set Names @@ -73,11 +73,11 @@ protected override void ProcessRecord() return; } - var contactsModel = new List(); + var contactsModel = new List(); foreach (var contact in contacts.ContactList) { - contactsModel.Add(KeyVaultCertificateContact.FromKVCertificateContact(contact)); + contactsModel.Add(PSKeyVaultCertificateContact.FromKVCertificateContact(contact)); } this.WriteObject(contactsModel); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs index 5390c15c0b94..ebcf51e51f47 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsCommon.Get, CmdletNoun.AzureKeyVaultCertificateOperation, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificateOperation))] + [OutputType(typeof(PSKeyVaultCertificateOperation))] public class GetAzureKeyVaultCertificateOperation : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -53,7 +53,7 @@ public class GetAzureKeyVaultCertificateOperation : KeyVaultCmdletBase protected override void ProcessRecord() { var certificateOperation = this.DataServiceClient.GetCertificateOperation(VaultName, Name); - var kvCertificateOperation = KeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); + var kvCertificateOperation = PSKeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); this.WriteObject(kvCertificateOperation); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs index e7ce4b06c729..6f8cb70848c1 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Commands [Cmdlet(VerbsCommon.Get, CmdletNoun.AzureKeyVaultCertificatePolicy, DefaultParameterSetName = ByVaultAndCertNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificatePolicy))] + [OutputType(typeof(PSKeyVaultCertificatePolicy))] public class GetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase { #region Parameter Set Names @@ -79,7 +79,7 @@ protected override void ProcessRecord() if (certificatePolicy != null) { - this.WriteObject(KeyVaultCertificatePolicy.FromCertificatePolicy(certificatePolicy)); + this.WriteObject(PSKeyVaultCertificatePolicy.FromCertificatePolicy(certificatePolicy)); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs index 316e657c4700..eb8e4563b7ec 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, "AzureKeyVaultKey", DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List), typeof(KeyBundle), typeof(List), typeof(DeletedKeyBundle))] + [OutputType(typeof(List), typeof(PSKeyBundle), typeof(List), typeof(DeletedKeyBundle))] public class GetAzureKeyVaultKey : KeyVaultCmdletBase { @@ -113,7 +113,7 @@ public class GetAzureKeyVaultKey : KeyVaultCmdletBase public override void ExecuteCmdlet() { - KeyBundle keyBundle; + PSKeyBundle keyBundle; switch (ParameterSetName) { case ByKeyNameParameterSet: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs index 9d96ed0a2c73..387ec200e19e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs @@ -28,7 +28,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.New, CmdletNoun.AzureKeyVaultCertificatePolicy, SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificatePolicy))] + [OutputType(typeof(PSKeyVaultCertificatePolicy))] public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -166,7 +166,7 @@ protected override void ProcessRecord() ValidateBothPercentageAndNumberOfDaysAreNotPresent(); ValidateAtLeastOneOfSubjectNameAndDnsNamesIsPresent(); - var policy = new KeyVaultCertificatePolicy + var policy = new PSKeyVaultCertificatePolicy { DnsNames = DnsNames, KeyUsage = KeyUsage, diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs index 35818e4452cf..20aa7504431e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs @@ -28,7 +28,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List))] + [OutputType(typeof(List))] public class RemoveAzureKeyVaultCertificateContact : KeyVaultCmdletBase { #region Parameter Set Names @@ -112,7 +112,7 @@ protected override void ProcessRecord() if (PassThru.IsPresent) { - this.WriteObject(KeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts)); + this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts)); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs index 75b097468a10..f83bd76273e4 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificateOperation))] + [OutputType(typeof(PSKeyVaultCertificateOperation))] public class RemoveAzureKeyVaultCertificateOperation : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -85,7 +85,7 @@ protected override void ProcessRecord() if (PassThru.IsPresent) { - var kvCertificateOperation = KeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); + var kvCertificateOperation = PSKeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); this.WriteObject(kvCertificateOperation); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs index fe59e9a81aa2..068816aae795 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsData.Restore, "AzureKeyVaultKey", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyBundle))] + [OutputType(typeof(PSKeyBundle))] public class RestoreAzureKeyVaultKey : KeyVaultCmdletBase { #region Input Parameter Definitions diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs index 5a720a6b9461..ad37fc5c207e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs @@ -28,7 +28,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = ExpandedParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificatePolicy))] + [OutputType(typeof(PSKeyVaultCertificatePolicy))] public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase { #region Parameter Set Names diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs index b5e636aa51fd..9df38050de63 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs @@ -31,7 +31,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = ExpandedParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificatePolicy))] + [OutputType(typeof(PSKeyVaultCertificatePolicy))] public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase { #region Parameter Set Names @@ -199,7 +199,7 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase Position = 2, HelpMessage = "Specifies the certificate policy.")] [ValidateNotNull] - public KeyVaultCertificatePolicy CertificatePolicy { get; set; } + public PSKeyVaultCertificatePolicy CertificatePolicy { get; set; } /// /// PassThru parameter @@ -212,7 +212,7 @@ protected override void ProcessRecord() { if (ShouldProcess(Name, Properties.Resources.SetCertificatePolicy)) { - KeyVaultCertificatePolicy policy; + PSKeyVaultCertificatePolicy policy; switch (ParameterSetName) { @@ -229,7 +229,7 @@ protected override void ProcessRecord() // Validate combinations of parameters ValidateBothPercentageAndNumberOfDaysAreNotPresent(); - policy = new KeyVaultCertificatePolicy + policy = new PSKeyVaultCertificatePolicy { DnsNames = DnsNames, KeyUsage = KeyUsage, @@ -267,7 +267,7 @@ protected override void ProcessRecord() if (PassThru.IsPresent) { - this.WriteObject(KeyVaultCertificatePolicy.FromCertificatePolicy(resultantPolicy)); + this.WriteObject(PSKeyVaultCertificatePolicy.FromCertificatePolicy(resultantPolicy)); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs index 7900998e1bd0..12bec4fbc3f7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Set, "AzureKeyVaultKeyAttribute", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyBundle))] + [OutputType(typeof(PSKeyBundle))] public class SetAzureKeyVaultKeyAttribute : KeyVaultCmdletBase { #region Input Parameter Definitions diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/StopAzureKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/StopAzureKeyVaultCertificateOperation.cs index e15b93948e95..60f6c49d8e52 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/StopAzureKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/StopAzureKeyVaultCertificateOperation.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificateOperation))] + [OutputType(typeof(PSKeyVaultCertificateOperation))] public class StopAzureKeyVaultCertificateOperation : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -78,7 +78,7 @@ protected override void ProcessRecord() () => { certificateOperation = this.DataServiceClient.CancelCertificateOperation(VaultName, Name); - var kvCertificateOperation = KeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); + var kvCertificateOperation = PSKeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); this.WriteObject(kvCertificateOperation); }); } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs index c356324f892d..1695e590bb00 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Undo, "AzureKeyVaultKeyRemoval", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyBundle))] + [OutputType(typeof(PSKeyBundle))] public class UndoAzureKeyVaultKeyRemoval : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -52,7 +52,7 @@ public override void ExecuteCmdlet() { if (ShouldProcess(Name, Properties.Resources.RecoverKey)) { - KeyBundle recoveredKey = DataServiceClient.RecoverKey(VaultName, Name); + PSKeyBundle recoveredKey = DataServiceClient.RecoverKey(VaultName, Name); WriteObject(recoveredKey); } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyBundle.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyBundle.cs index 2129d75c2c77..792f4339709c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyBundle.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyBundle.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class DeletedKeyBundle : KeyBundle + public class DeletedKeyBundle : PSKeyBundle { public DeletedKeyBundle() { } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs index 5770a57bf8e5..08daeadeb538 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs @@ -24,13 +24,13 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { public interface IKeyVaultDataServiceClient { - KeyBundle CreateKey(string vaultName, string keyName, KeyAttributes keyAttributes); + PSKeyBundle CreateKey(string vaultName, string keyName, KeyAttributes keyAttributes); - KeyBundle ImportKey(string vaultName, string keyName, KeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm); + PSKeyBundle ImportKey(string vaultName, string keyName, KeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm); - KeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, KeyAttributes keyAttributes); + PSKeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, KeyAttributes keyAttributes); - KeyBundle GetKey(string vaultName, string keyName, string keyVersion); + PSKeyBundle GetKey(string vaultName, string keyName, string keyVersion); DeletedKeyBundle GetDeletedKey(string vaultName, string name); @@ -44,7 +44,7 @@ public interface IKeyVaultDataServiceClient void PurgeKey(string vaultName, string name); - KeyBundle RecoverKey(string vaultName, string keyName); + PSKeyBundle RecoverKey(string vaultName, string keyName); Secret SetSecret(string vaultName, string secretName, SecureString secretValue, SecretAttributes secretAttributes); @@ -68,7 +68,7 @@ public interface IKeyVaultDataServiceClient string BackupKey(string vaultName, string keyName, string outputBlobPath); - KeyBundle RestoreKey(string vaultName, string inputBlobPath); + PSKeyBundle RestoreKey(string vaultName, string inputBlobPath); string BackupSecret(string vaultName, string secretName, string outputBlobPath); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyBundle.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyBundle.cs index d87c8b9396cf..24d12089d22f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyBundle.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyBundle.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class KeyBundle : ObjectIdentifier + public class PSKeyBundle : ObjectIdentifier { - public KeyBundle() + public PSKeyBundle() { } - internal KeyBundle(Azure.KeyVault.Models.KeyBundle keyBundle, VaultUriHelper vaultUriHelper) + internal PSKeyBundle(Azure.KeyVault.Models.KeyBundle keyBundle, VaultUriHelper vaultUriHelper) { if (keyBundle == null) throw new ArgumentNullException("keyBundle"); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyIdentityItem.cs index 2dc38b6e70e7..f7310d2f929c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyIdentityItem.cs @@ -40,7 +40,7 @@ internal KeyIdentityItem(Azure.KeyVault.Models.KeyItem keyItem, VaultUriHelper v Tags = (keyItem.Tags == null) ? null : keyItem.Tags.ConvertToHashtable(); } - internal KeyIdentityItem(KeyBundle keyBundle) + internal KeyIdentityItem(PSKeyBundle keyBundle) { if (keyBundle == null) throw new ArgumentNullException("keyBundle"); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs index b5be52dcfc09..bf0d62d33e32 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs @@ -58,7 +58,7 @@ public KeyVaultDataServiceClient() { } - public KeyBundle CreateKey(string vaultName, string keyName, KeyAttributes keyAttributes) + public PSKeyBundle CreateKey(string vaultName, string keyName, KeyAttributes keyAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -86,7 +86,7 @@ public KeyBundle CreateKey(string vaultName, string keyName, KeyAttributes keyAt throw GetInnerException(ex); } - return new KeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyBundle(keyBundle, this.vaultUriHelper); } public CertificateBundle MergeCertificate(string vaultName, string certName, X509Certificate2Collection certs, IDictionary tags) @@ -179,7 +179,7 @@ public CertificateBundle ImportCertificate(string vaultName, string certName, X5 return certBundle; } - public KeyBundle ImportKey(string vaultName, string keyName, KeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm) + public PSKeyBundle ImportKey(string vaultName, string keyName, KeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -211,10 +211,10 @@ public KeyBundle ImportKey(string vaultName, string keyName, KeyAttributes keyAt throw GetInnerException(ex); } - return new KeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyBundle(keyBundle, this.vaultUriHelper); } - public KeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, KeyAttributes keyAttributes) + public PSKeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, KeyAttributes keyAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -237,7 +237,7 @@ public KeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, throw GetInnerException(ex); } - return new KeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyBundle(keyBundle, this.vaultUriHelper); } public Contacts GetCertificateContacts(string vaultName) @@ -298,7 +298,7 @@ public CertificateBundle GetCertificate(string vaultName, string certName, strin return certBundle; } - public KeyBundle GetKey(string vaultName, string keyName, string keyVersion) + public PSKeyBundle GetKey(string vaultName, string keyName, string keyVersion) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -324,7 +324,7 @@ public KeyBundle GetKey(string vaultName, string keyName, string keyVersion) throw GetInnerException(ex); } - return new KeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyBundle(keyBundle, this.vaultUriHelper); } public IEnumerable GetCertificates(KeyVaultObjectFilterOptions options) @@ -845,7 +845,7 @@ public string BackupKey(string vaultName, string keyName, string outputBlobPath) return outputBlobPath; } - public KeyBundle RestoreKey(string vaultName, string inputBlobPath) + public PSKeyBundle RestoreKey(string vaultName, string inputBlobPath) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -866,7 +866,7 @@ public KeyBundle RestoreKey(string vaultName, string inputBlobPath) throw GetInnerException(ex); } - return new KeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyBundle(keyBundle, this.vaultUriHelper); } public string BackupSecret( string vaultName, string secretName, string outputBlobPath ) @@ -1544,7 +1544,7 @@ public void PurgeSecret(string vaultName, string secretName) } } - public KeyBundle RecoverKey(string vaultName, string keyName) + public PSKeyBundle RecoverKey(string vaultName, string keyName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException("vaultName"); @@ -1563,7 +1563,7 @@ public KeyBundle RecoverKey(string vaultName, string keyName) throw GetInnerException(ex); } - return new KeyBundle(recoveredKey, this.vaultUriHelper); + return new PSKeyBundle(recoveredKey, this.vaultUriHelper); } public Secret RecoverSecret(string vaultName, string secretName) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateContact.cs similarity index 78% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateContact.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateContact.cs index a671c58e659a..27706d341f6d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateContact.cs @@ -17,21 +17,21 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class KeyVaultCertificateContact + public class PSKeyVaultCertificateContact { public string Email { get; set; } - internal static KeyVaultCertificateContact FromKVCertificateContact(Contact contact) + internal static PSKeyVaultCertificateContact FromKVCertificateContact(Contact contact) { - return new KeyVaultCertificateContact + return new PSKeyVaultCertificateContact { Email = contact.EmailAddress, }; } - internal static List FromKVCertificateContacts(Contacts contacts) + internal static List FromKVCertificateContacts(Contacts contacts) { - var result = new List(); + var result = new List(); if (contacts != null && contacts.ContactList != null) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOperation.cs similarity index 91% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateOperation.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOperation.cs index c0e444a84e0c..1388d935501c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOperation.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class KeyVaultCertificateOperation + public class PSKeyVaultCertificateOperation { public string Id { get; private set; } public string Status { get; private set; } @@ -30,14 +30,14 @@ public class KeyVaultCertificateOperation public string ErrorCode { get; private set; } public string ErrorMessage { get; private set; } - internal static KeyVaultCertificateOperation FromCertificateOperation(CertificateOperation certificateOperation) + internal static PSKeyVaultCertificateOperation FromCertificateOperation(CertificateOperation certificateOperation) { if (certificateOperation == null) { return null; } - var kvCertificateOperation = new KeyVaultCertificateOperation + var kvCertificateOperation = new PSKeyVaultCertificateOperation { Id = certificateOperation.Id, Status = certificateOperation.Status, diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificatePolicy.cs similarity index 98% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificatePolicy.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificatePolicy.cs index 2bfb145e01f9..38a32b798b30 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificatePolicy.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class KeyVaultCertificatePolicy + public class PSKeyVaultCertificatePolicy { public string SecretContentType { get; set; } public string Kty { get; set; } @@ -42,7 +42,7 @@ public class KeyVaultCertificatePolicy public DateTime? Created { get; internal set; } public DateTime? Updated { get; internal set; } - public KeyVaultCertificatePolicy() + public PSKeyVaultCertificatePolicy() { // At this time, KV Certificate only support these options // and the service requires these values to be passed when @@ -205,9 +205,9 @@ internal CertificatePolicy ToCertificatePolicy() return certificatePolicy; } - internal static KeyVaultCertificatePolicy FromCertificatePolicy(CertificatePolicy certificatePolicy) + internal static PSKeyVaultCertificatePolicy FromCertificatePolicy(CertificatePolicy certificatePolicy) { - return new KeyVaultCertificatePolicy + return new PSKeyVaultCertificatePolicy { SecretContentType = certificatePolicy.SecretProperties == null ? null : certificatePolicy.SecretProperties.ContentType, Kty = certificatePolicy.KeyProperties == null ? null : certificatePolicy.KeyProperties.KeyType, From a5ad7f8ad1031c10c95ee4925c0b4317729d55d8 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Wed, 21 Feb 2018 18:11:47 -0800 Subject: [PATCH 02/19] more changes --- .../UnitTests/RemoveKeyVaultKeyTests.cs | 8 +- .../UnitTests/RemoveKeyVaultSecretTests.cs | 8 +- .../SetKeyVaultSecretAttributeTests.cs | 8 +- .../UnitTests/SetKeyVaultSecretTests.cs | 8 +- .../Commands.KeyVault.csproj | 26 +-- .../Commands/AddAzureKeyVaultCertificate.cs | 1 + .../AddAzureKeyVaultCertificateContact.cs | 1 - .../Commands/AddAzureKeyVaultKey.cs | 1 - .../Commands/BackupAzureKeyVaultKey.cs | 46 ++--- .../Commands/BackupAzureKeyVaultSecret.cs | 45 ++--- .../Commands/GetAzureKeyVault.cs | 15 +- .../Commands/GetAzureKeyVaultCertificate.cs | 162 +++++++++++++----- .../GetAzureKeyVaultCertificateContact.cs | 37 +++- .../GetAzureKeyVaultCertificateIssuer.cs | 48 +++--- .../GetAzureKeyVaultCertificateOperation.cs | 31 +++- .../GetAzureKeyVaultCertificatePolicy.cs | 21 ++- .../Commands/GetAzureKeyVaultKey.cs | 141 ++++++++++----- .../Commands/GetAzureKeyVaultSecret.cs | 137 ++++++++++----- .../ImportAzureKeyVaultCertificate.cs | 4 +- .../RemoveAzureKeyVaultCertificate.cs | 6 +- .../RemoveAzureKeyVaultCertificateIssuer.cs | 6 +- .../Commands/RemoveAzureKeyVaultKey.cs | 4 +- .../Commands/RemoveAzureKeyVaultSecret.cs | 4 +- .../Commands/RestoreAzureKeyVaultSecret.cs | 2 +- .../SetAzureKeyVaultCertificateAttribute.cs | 4 +- .../SetAzureKeyVaultCertificateIssuer.cs | 8 +- .../Commands/SetAzureKeyVaultSecret.cs | 2 +- .../SetAzureKeyVaultSecretAttribute.cs | 2 +- .../UndoAzureKeyVaultSecretRemoval.cs | 4 +- .../Models/IKeyVaultDataServiceClient.cs | 38 ++-- .../Models/KeyVaultDataServiceClient.cs | 90 +++++----- ...tyItem.cs => PSCertificateIdentityItem.cs} | 6 +- ....cs => PSCertificateIssuerIdentityItem.cs} | 6 +- ...cs => PSDeletedCertificateIdentityItem.cs} | 6 +- ...etedKeyBundle.cs => PSDeletedKeyBundle.cs} | 6 +- ...ityItem.cs => PSDeletedKeyIdentityItem.cs} | 6 +- ...ate.cs => PSDeletedKeyVaultCertificate.cs} | 8 +- .../{DeletedSecret.cs => PSDeletedSecret.cs} | 6 +- ...Item.cs => PSDeletedSecretIdentityItem.cs} | 6 +- ...eyIdentityItem.cs => PSKeyIdentityItem.cs} | 6 +- ...ertificate.cs => PSKeyVaultCertificate.cs} | 12 +- ...suer.cs => PSKeyVaultCertificateIssuer.cs} | 6 +- .../Models/{Secret.cs => PSSecret.cs} | 6 +- ...dentityItem.cs => PSSecretIdentityItem.cs} | 6 +- 44 files changed, 631 insertions(+), 373 deletions(-) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{CertificateIdentityItem.cs => PSCertificateIdentityItem.cs} (92%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{CertificateIssuerIdentityItem.cs => PSCertificateIssuerIdentityItem.cs} (86%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{DeletedCertificateIdentityItem.cs => PSDeletedCertificateIdentityItem.cs} (82%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{DeletedKeyBundle.cs => PSDeletedKeyBundle.cs} (81%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{DeletedKeyIdentityItem.cs => PSDeletedKeyIdentityItem.cs} (80%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{DeletedKeyVaultCertificate.cs => PSDeletedKeyVaultCertificate.cs} (77%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{DeletedSecret.cs => PSDeletedSecret.cs} (85%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{DeletedSecretIdentityItem.cs => PSDeletedSecretIdentityItem.cs} (79%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyIdentityItem.cs => PSKeyIdentityItem.cs} (93%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyVaultCertificate.cs => PSKeyVaultCertificate.cs} (88%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyVaultCertificateIssuer.cs => PSKeyVaultCertificateIssuer.cs} (90%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{Secret.cs => PSSecret.cs} (92%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{SecretIdentityItem.cs => PSSecretIdentityItem.cs} (92%) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs index 7cecb31bbb9a..309fff18f8dd 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs @@ -26,7 +26,7 @@ public class RemoveKeyVaultKeyTests : KeyVaultUnitTestBase private RemoveAzureKeyVaultKey cmdlet; private KeyAttributes keyAttributes; private WebKey.JsonWebKey webKey; - private DeletedKeyBundle keyBundle; + private PSDeletedKeyBundle keyBundle; public RemoveKeyVaultKeyTests() { @@ -41,14 +41,14 @@ public RemoveKeyVaultKeyTests() keyAttributes = new KeyAttributes(true, DateTime.Now, DateTime.Now, "HSM", new string[] { "All" }, null); webKey = new WebKey.JsonWebKey(); - keyBundle = new DeletedKeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName }; + keyBundle = new PSDeletedKeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName }; } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void CanRemoveKeyWithPassThruTest() { - DeletedKeyBundle expected = keyBundle; + PSDeletedKeyBundle expected = keyBundle; keyVaultClientMock.Setup(kv => kv.DeleteKey(VaultName, KeyName)).Returns(expected).Verifiable(); // Mock the should process to return true @@ -67,7 +67,7 @@ public void CanRemoveKeyWithPassThruTest() [Trait(Category.AcceptanceType, Category.CheckIn)] public void CanRemoveKeyWithNoPassThruTest() { - DeletedKeyBundle expected = keyBundle; + PSDeletedKeyBundle expected = keyBundle; keyVaultClientMock.Setup(kv => kv.DeleteKey(VaultName, KeyName)).Returns(expected).Verifiable(); // Mock the should process to return true diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultSecretTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultSecretTests.cs index 8705482a7a9f..b7cea2b17d5f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultSecretTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultSecretTests.cs @@ -42,7 +42,7 @@ public RemoveKeyVaultSecretTests() public void CanRemoveSecretWithPassThruTest() { SecureString secureSecretValue = SecretValue.ConvertToSecureString(); - DeletedSecret expected = new DeletedSecret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue }; + PSDeletedSecret expected = new PSDeletedSecret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue }; keyVaultClientMock.Setup(kv => kv.DeleteSecret(VaultName, SecretName)).Returns(expected).Verifiable(); // Mock the should process to return true @@ -71,7 +71,7 @@ public void CanRemoveSecretWithPassThruTest() public void CanRemoveSecretWithNoPassThruTest() { SecureString secureSecretValue = SecretValue.ConvertToSecureString(); - DeletedSecret expected = new DeletedSecret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue }; + PSDeletedSecret expected = new PSDeletedSecret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue }; keyVaultClientMock.Setup(kv => kv.DeleteSecret(VaultName, SecretName)).Returns(expected).Verifiable(); // Mock the should process to return true @@ -93,7 +93,7 @@ public void CannotRemoveSecretWithoutShouldProcessOrForceConfirmationTest() // Should process but without force commandRuntimeMock.Setup(cr => cr.ShouldProcess(SecretName, It.IsAny())).Returns(true); - Secret expected = null; + PSSecret expected = null; cmdlet.Name = SecretName; cmdlet.PassThru = true; @@ -125,7 +125,7 @@ public void ErrorRemoveSecretWithPassThruTest() catch { } keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs index 2f91408d6e41..dc72a033514f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs @@ -26,13 +26,13 @@ public class SetKeyVaultSecretAttributeTests : KeyVaultUnitTestBase { private SetAzureKeyVaultSecretAttribute cmdlet; private SecretAttributes secretAttributes; - private Secret secret; + private PSSecret secret; public SetKeyVaultSecretAttributeTests() { base.SetupTest(); secretAttributes = new SecretAttributes(true, DateTime.UtcNow.AddYears(2), DateTime.UtcNow, "contenttype", null); - secret = new Secret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = null, Attributes = secretAttributes }; + secret = new PSSecret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = null, Attributes = secretAttributes }; cmdlet = new SetAzureKeyVaultSecretAttribute() { @@ -57,7 +57,7 @@ public void CanSetSecretAttributeTest() // Mock the should process to return true commandRuntimeMock.Setup(cr => cr.ShouldProcess(SecretName, It.IsAny())).Returns(true); - Secret expected = secret; + PSSecret expected = secret; keyVaultClientMock.Setup(kv => kv.UpdateSecret(VaultName, SecretName, SecretVersion, It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires @@ -94,7 +94,7 @@ public void ErrorSetSecretAttributeTest() catch { } keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs index 574a7566b961..8fad6a0ccbf4 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs @@ -27,7 +27,7 @@ public class SetKeyVaultSecretTests : KeyVaultUnitTestBase private SetAzureKeyVaultSecret cmdlet; private SecretAttributes secretAttributes; private SecureString secureSecretValue; - private Secret secret; + private PSSecret secret; public SetKeyVaultSecretTests() { @@ -35,7 +35,7 @@ public SetKeyVaultSecretTests() secretAttributes = new SecretAttributes(true, null, null, null, null); secureSecretValue = SecretValue.ConvertToSecureString(); - secret = new Secret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = secureSecretValue, Attributes = secretAttributes }; + secret = new PSSecret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = secureSecretValue, Attributes = secretAttributes }; cmdlet = new SetAzureKeyVaultSecret() { @@ -56,7 +56,7 @@ public SetKeyVaultSecretTests() [Trait(Category.AcceptanceType, Category.CheckIn)] public void CanSetSecretTest() { - Secret expected = secret; + PSSecret expected = secret; keyVaultClientMock.Setup(kv => kv.SetSecret(VaultName, SecretName, secureSecretValue, It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires @@ -96,7 +96,7 @@ public void ErrorSetSecretTest() catch { } keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj index fa40e46d3c50..6be6441e1865 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj @@ -93,20 +93,20 @@ - - + + - + - - - - - - + + + + + + - + @@ -159,14 +159,14 @@ - + - + - + diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs index 6a25c9136c2c..270aeed3f3ec 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs @@ -58,6 +58,7 @@ public class AddAzureKeyVaultCertificate : KeyVaultCmdletBase Position = 2, HelpMessage = "Specifies the certificate policy.")] [ValidateNotNull] + [Alias("InputObject")] public PSKeyVaultCertificatePolicy CertificatePolicy { get; set; } /// diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs index 0e027e71efe0..f8be10fab828 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs @@ -61,7 +61,6 @@ public class AddAzureKeyVaultCertificateContact : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "KeyVault object.")] [ValidateNotNullOrEmpty] - [Alias("VaultObject")] public PSVault InputObject { get; set; } /// diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs index 94a9df35655b..15e52c18cd75 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs @@ -83,7 +83,6 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Vault object.")] [ValidateNotNullOrEmpty] - [Alias("VaultObject")] public PSVault InputObject { get; set; } /// diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs index 2e3bffd76e63..7f5aa865bb89 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs @@ -53,21 +53,6 @@ public class BackupAzureKeyVaultKey : KeyVaultCmdletBase [ValidateNotNullOrEmpty] public string VaultName { get; set; } - /// - /// KeyBundle object to be backed up. - /// - /// - /// Note that the backup applies to the entire family of a key (current and all its versions); - /// since a key bundle represents a single version, the intent of this parameter is to allow pipelining. - /// The backup cmdlet will use the Name and VaultName properties of the KeyBundle parameter. - /// - [Parameter( Mandatory = true, - Position = 0, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ByKeyObjectParameterSet, - HelpMessage = "Key bundle to back up, pipelined in from the output of a retrieval call." )] - public PSKeyBundle Key { get; set; } - /// /// Key name /// @@ -80,6 +65,22 @@ public class BackupAzureKeyVaultKey : KeyVaultCmdletBase [Alias(Constants.KeyName)] public string Name { get; set; } + /// + /// KeyBundle object to be backed up. + /// + /// + /// Note that the backup applies to the entire family of a key (current and all its versions); + /// since a key bundle represents a single version, the intent of this parameter is to allow pipelining. + /// The backup cmdlet will use the Name and VaultName properties of the KeyBundle parameter. + /// + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByKeyObjectParameterSet, + HelpMessage = "Key bundle to back up, pipelined in from the output of a retrieval call.")] + [ValidateNotNullOrEmpty] + public PSKeyBundle InputObject { get; set; } + /// /// The output file in which the backup blob is to be stored /// @@ -103,19 +104,10 @@ public class BackupAzureKeyVaultKey : KeyVaultCmdletBase public override void ExecuteCmdlet() { - switch ( ParameterSetName ) + if (InputObject != null) { - case ByKeyNameParameterSet: - // no op - break; - - case ByKeyObjectParameterSet: - Name = Key.Name; - VaultName = Key.VaultName; - break; - - default: - throw new ArgumentException( KeyVaultProperties.Resources.BadParameterSetName ); + Name = InputObject.Name; + VaultName = InputObject.VaultName; } if ( ShouldProcess(Name, Properties.Resources.BackupKey)) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs index 6396bcf67a49..06f65dd58c39 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs @@ -53,6 +53,18 @@ public class BackupAzureKeyVaultSecret : KeyVaultCmdletBase [ValidateNotNullOrEmpty] public string VaultName { get; set; } + /// + /// Secret name + /// + [Parameter( Mandatory = true, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = BySecretNameParameterSet, + HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name." )] + [ValidateNotNullOrEmpty] + [Alias( Constants.SecretName )] + public string Name { get; set; } + /// /// The secret object to be backed up. /// @@ -61,25 +73,13 @@ public class BackupAzureKeyVaultSecret : KeyVaultCmdletBase /// since a key bundle represents a single version, the intent of this parameter is to allow pipelining. /// The backup cmdlet will use the Name and VaultName properties of the KeyBundle parameter. /// - [Parameter( Mandatory = true, + [Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = BySecretObjectParameterSet, - HelpMessage = "Secret to be backed up, pipelined in from the output of a retrieval call." )] + HelpMessage = "Secret to be backed up, pipelined in from the output of a retrieval call.")] [ValidateNotNullOrEmpty] - public Secret Secret { get; set; } - - /// - /// Secret name - /// - [Parameter( Mandatory = true, - Position = 1, - ValueFromPipelineByPropertyName = true, - ParameterSetName = BySecretNameParameterSet, - HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name." )] - [ValidateNotNullOrEmpty] - [Alias( Constants.SecretName )] - public string Name { get; set; } + public PSSecret InputObject { get; set; } /// /// The output file in which the backup blob is to be stored @@ -104,19 +104,10 @@ public class BackupAzureKeyVaultSecret : KeyVaultCmdletBase public override void ExecuteCmdlet( ) { - switch ( ParameterSetName ) + if (InputObject != null) { - case BySecretNameParameterSet: - // no op - break; - - case BySecretObjectParameterSet: - Name = Secret.Name; - VaultName = Secret.VaultName; - break; - - default: - throw new ArgumentException( KeyVaultProperties.Resources.BadParameterSetName ); + Name = InputObject.Name; + VaultName = InputObject.VaultName; } if ( ShouldProcess( Name, Properties.Resources.BackupSecret ) ) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs index 202c8e917739..a6170c7cec67 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs @@ -17,15 +17,16 @@ using System.Collections; using System.Collections.Generic; using System.Management.Automation; -using PSKeyVaultModels = Microsoft.Azure.Commands.KeyVault.Models; +using Microsoft.Azure.Commands.KeyVault.Models; using PSKeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { - [Cmdlet(VerbsCommon.Get, "AzureRmKeyVault", + [Cmdlet(VerbsCommon.Get, "AzureRmKeyVault", + DefaultParameterSetName = ListVaultsBySubParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSKeyVaultModels.PSVault), typeof(List), - typeof(PSKeyVaultModels.PSDeletedVault), typeof(List))] + [OutputType(typeof(PSVault), typeof(List), + typeof(PSDeletedVault), typeof(List))] public class GetAzureKeyVault : KeyVaultManagementCmdletBase { #region Parameter Set Names @@ -66,7 +67,7 @@ public class GetAzureKeyVault : KeyVaultManagementCmdletBase ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the name of the resource group associated with the key vault being queried.")] [Parameter(Mandatory = true, - Position = 1, + Position = 0, ParameterSetName = ListVaultsByRGParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the name of a resource group. This cmdlet gets key vault instances in the resource group that this parameter specifies.")] @@ -75,7 +76,7 @@ public class GetAzureKeyVault : KeyVaultManagementCmdletBase public string ResourceGroupName { get; set; } [Parameter(Mandatory = true, - Position = 2, + Position = 1, ParameterSetName = GetDeletedVaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "The location of the deleted vault.")] @@ -108,7 +109,7 @@ public override void ExecuteCmdlet() { case GetVaultParameterSet: ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName; - PSKeyVaultModels.PSVault vault = null; + PSVault vault = null; if (!string.IsNullOrWhiteSpace(ResourceGroupName)) vault = KeyVaultManagementClient.GetVault( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs index 954ce998e782..5048e9f834b9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs @@ -19,6 +19,7 @@ using Microsoft.Azure.Commands.KeyVault.Models; using Microsoft.Azure.KeyVault.Models; using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; namespace Microsoft.Azure.Commands.KeyVault { @@ -28,15 +29,18 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, CmdletNoun.AzureKeyVaultCertificate, DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List), typeof(KeyVaultCertificate), typeof(DeletedKeyVaultCertificate), typeof(List))] + [OutputType(typeof(List), typeof(PSKeyVaultCertificate), typeof(PSDeletedKeyVaultCertificate), typeof(List))] public class GetAzureKeyVaultCertificate : KeyVaultCmdletBase { #region Parameter Set Names - private const string ByCertificateNameParameterSet = "ByCertificateName"; - private const string ByVaultNameParameterSet = "ByVaultName"; - private const string ByCertificateVersionsParameterSet = "ByCertificateVersions"; - private const string ByDeletedCertificateParameterSet = "ByDeletedCertificates"; + private const string ByVaultNameParameterSet = "ByName"; + private const string ByCertificateNameandVersionParameterSet = "ByCertificateNameAndVersion"; + private const string ByCertificateVersionsParameterSet = "ByCertificateAllVersions"; + + private const string InputObjectByVaultNameParameterSet = "ByNameInputObject"; + private const string InputObjectByCertificateNameandVersionParameterSet = "ByCertificateNameAndVersionInputObject"; + private const string InputObjectByCertificateVersionsParameterSet = "ByCertificateAllVersionsInputObject"; #endregion @@ -46,30 +50,74 @@ public class GetAzureKeyVaultCertificate : KeyVaultCmdletBase /// VaultName /// [Parameter(Mandatory = true, + ParameterSetName = ByVaultNameParameterSet, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] + [Parameter(Mandatory = true, + ParameterSetName = ByCertificateNameandVersionParameterSet, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] + [Parameter(Mandatory = true, + ParameterSetName = ByCertificateVersionsParameterSet, Position = 0, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByVaultNameParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "KeyVault object.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByCertificateNameandVersionParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "KeyVault object.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByCertificateVersionsParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "KeyVault object.")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + /// /// Name /// + [Parameter(Mandatory = false, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByVaultNameParameterSet, + HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name.")] + [Parameter(Mandatory = false, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = InputObjectByVaultNameParameterSet, + HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name.")] [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, - ParameterSetName = ByCertificateNameParameterSet, + ParameterSetName = ByCertificateNameandVersionParameterSet, HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name.")] [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, - ParameterSetName = ByCertificateVersionsParameterSet, + ParameterSetName = InputObjectByCertificateNameandVersionParameterSet, HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name.")] - [Parameter( Mandatory = false, + [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, - ParameterSetName = ByDeletedCertificateParameterSet, + ParameterSetName = ByCertificateVersionsParameterSet, HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name." )] + [Parameter(Mandatory = true, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = InputObjectByCertificateVersionsParameterSet, + HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name.")] [ValidateNotNullOrEmpty] [Alias(Constants.CertificateName)] public string Name { get; set; } @@ -77,8 +125,13 @@ public class GetAzureKeyVaultCertificate : KeyVaultCmdletBase /// /// Certificate version. /// - [Parameter(Mandatory = false, - ParameterSetName = ByCertificateNameParameterSet, + [Parameter(Mandatory = true, + ParameterSetName = ByCertificateNameandVersionParameterSet, + Position = 2, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the version of the certificate in key vault.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByCertificateNameandVersionParameterSet, Position = 2, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the version of the certificate in key vault.")] @@ -88,56 +141,71 @@ public class GetAzureKeyVaultCertificate : KeyVaultCmdletBase [Parameter(Mandatory = true, ParameterSetName = ByCertificateVersionsParameterSet, HelpMessage = "Specifies whether to include the versions of the certificate in the output.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByCertificateVersionsParameterSet, + HelpMessage = "Specifies whether to include the versions of the certificate in the output.")] public SwitchParameter IncludeVersions { get; set; } /// /// Switch specifying whether to apply the command to certificates in a deleted state. /// - [Parameter( Mandatory = true, - ParameterSetName = ByDeletedCertificateParameterSet, - HelpMessage = "Specifies whether to show the previously deleted certificates in the output." )] + [Parameter(Mandatory = false, + ParameterSetName = ByVaultNameParameterSet, + HelpMessage = "Specifies whether to show the previously deleted certificates in the output." )] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByVaultNameParameterSet, + HelpMessage = "Specifies whether to show the previously deleted certificates in the output.")] public SwitchParameter InRemovedState { get; set; } #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { CertificateBundle certBundle; - switch (ParameterSetName) + if (InputObject != null) { - case ByCertificateNameParameterSet: - certBundle = this.DataServiceClient.GetCertificate(VaultName, Name, Version ?? string.Empty); - var certificate = KeyVaultCertificate.FromCertificateBundle(certBundle); - this.WriteObject(certificate); - break; + VaultName = InputObject.VaultName.ToString(); + } - case ByCertificateVersionsParameterSet: - certBundle = this.DataServiceClient.GetCertificate(VaultName, Name, string.Empty); - if (certBundle != null) - { - WriteObject(new CertificateIdentityItem(certBundle)); - GetAndWriteCertificatesVersions(VaultName, Name, certBundle.CertificateIdentifier.Version); - } - break; - - case ByVaultNameParameterSet: + if (!string.IsNullOrEmpty(Version)) + { + certBundle = this.DataServiceClient.GetCertificate(VaultName, Name, Version); + var certificate = PSKeyVaultCertificate.FromCertificateBundle(certBundle); + this.WriteObject(certificate); + } + else if (IncludeVersions) + { + certBundle = this.DataServiceClient.GetCertificate(VaultName, Name, string.Empty); + if (certBundle != null) + { + WriteObject(new PSCertificateIdentityItem(certBundle)); + GetAndWriteCertificatesVersions(VaultName, Name, certBundle.CertificateIdentifier.Version); + } + } + else if (InRemovedState) + { + if (Name == null) + { + GetAndWriteDeletedCertificates(VaultName); + } + else + { + PSDeletedKeyVaultCertificate deletedCert = PSDeletedKeyVaultCertificate.FromDeletedCertificateBundle(DataServiceClient.GetDeletedCertificate(VaultName, Name)); + WriteObject(deletedCert); + } + } + else + { + if (string.IsNullOrEmpty(Name)) + { GetAndWriteCertificates(VaultName); - break; - - case ByDeletedCertificateParameterSet: - if ( Name == null ) - { - GetAndWriteDeletedCertificates( VaultName ); - break; - } - - DeletedKeyVaultCertificate deletedCert = DeletedKeyVaultCertificate.FromDeletedCertificateBundle( DataServiceClient.GetDeletedCertificate(VaultName, Name) ); - WriteObject( deletedCert ); - - break; - - default: - throw new ArgumentException(KeyVaultProperties.Resources.BadParameterSetName); + } + else + { + certBundle = this.DataServiceClient.GetCertificate(VaultName, Name, string.Empty); + var certificate = PSKeyVaultCertificate.FromCertificateBundle(certBundle); + this.WriteObject(certificate); + } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs index c493617e5039..779b8ec8fe39 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs @@ -14,6 +14,7 @@ using Microsoft.Azure.Commands.KeyVault.Models; using Microsoft.Azure.KeyVault.Models; +using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; using System.Collections.Generic; using System.Management.Automation; @@ -31,6 +32,8 @@ public class GetAzureKeyVaultCertificateContact : KeyVaultCmdletBase #region Parameter Set Names private const string ByVaultNameParameterSet = "VaultName"; + private const string ByInputObjectParameterSet = "ByInputObject"; + private const string ByResourceIdParameterSet = "ByResourceId"; #endregion @@ -47,12 +50,44 @@ public class GetAzureKeyVaultCertificateContact : KeyVaultCmdletBase [ValidateNotNullOrEmpty] public string VaultName { get; set; } + /// + /// InputObject + /// + [Parameter(Mandatory = true, + ParameterSetName = ByInputObjectParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "KeyVault object.")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + + /// + /// ResourceId + /// + [Parameter(Mandatory = true, + ParameterSetName = ByResourceIdParameterSet, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "KeyVault Id.")] + [ValidateNotNullOrEmpty] + public string ResourceId { get; set; } + #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { Contacts contacts; + if (InputObject != null) + { + VaultName = InputObject.VaultName.ToString(); + } + else if (!string.IsNullOrEmpty(ResourceId)) + { + var parsedResourceId = new ResourceIdentifier(ResourceId); + VaultName = parsedResourceId.ResourceName; + } + try { contacts = this.DataServiceClient.GetCertificateContacts(this.VaultName); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs index 858e78808f7e..8ad3b83bdad8 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs @@ -12,10 +12,8 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; using System.Management.Automation; using Microsoft.Azure.Commands.KeyVault.Models; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; using System.Collections.Generic; namespace Microsoft.Azure.Commands.KeyVault @@ -24,15 +22,15 @@ namespace Microsoft.Azure.Commands.KeyVault /// The Get-AzureKeyVaultCertificate cmdlet gets the certificates in an Azure Key Vault or the current version of the certificate. /// [Cmdlet(VerbsCommon.Get, CmdletNoun.AzureKeyVaultCertificateIssuer, - DefaultParameterSetName = ByVaultNameParameterSet, + DefaultParameterSetName = ByNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List), typeof(KeyVaultCertificateIssuer))] + [OutputType(typeof(List), typeof(PSKeyVaultCertificateIssuer))] public class GetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase { #region Parameter Set Names private const string ByNameParameterSet = "ByName"; - private const string ByVaultNameParameterSet = "ByVaultName"; + private const string ByInputObjectParameterSet = "ByInputObject"; #endregion @@ -42,6 +40,7 @@ public class GetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase /// Vault name /// [Parameter(Mandatory = true, + ParameterSetName = ByNameParameterSet, Position = 0, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] @@ -49,10 +48,20 @@ public class GetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase public string VaultName { get; set; } /// - /// Name. + /// Vault object /// [Parameter(Mandatory = true, - ParameterSetName = ByNameParameterSet, + ParameterSetName = ByInputObjectParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "KeyVault object.")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + + /// + /// Name. + /// + [Parameter(Mandatory = false, Position = 1, ValueFromPipelineByPropertyName = true, HelpMessage = "Issuer name. Cmdlet constructs the FQDN of a certificate issuer from vault name, currently selected environment and issuer name.")] @@ -62,22 +71,21 @@ public class GetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { - - switch (ParameterSetName) + if (InputObject != null) { - case ByNameParameterSet: - var issuer = this.DataServiceClient.GetCertificateIssuer(VaultName, Name); - this.WriteObject(KeyVaultCertificateIssuer.FromIssuer(issuer)); - break; - - case ByVaultNameParameterSet: - GetAndWriteCertificateIssuers(VaultName); - break; + VaultName = InputObject.VaultName.ToString(); + } - default: - throw new ArgumentException(KeyVaultProperties.Resources.BadParameterSetName); + if (string.IsNullOrEmpty(Name)) + { + GetAndWriteCertificateIssuers(VaultName); + } + else + { + var issuer = this.DataServiceClient.GetCertificateIssuer(VaultName, Name); + this.WriteObject(PSKeyVaultCertificateIssuer.FromIssuer(issuer)); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs index ebcf51e51f47..6ca0a37a869e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs @@ -20,17 +20,26 @@ namespace Microsoft.Azure.Commands.KeyVault /// /// Gets the status of the certificate operation /// - [Cmdlet(VerbsCommon.Get, CmdletNoun.AzureKeyVaultCertificateOperation, + [Cmdlet(VerbsCommon.Get, CmdletNoun.AzureKeyVaultCertificateOperation, + DefaultParameterSetName = ByNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSKeyVaultCertificateOperation))] public class GetAzureKeyVaultCertificateOperation : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string ByNameParameterSet = "ByName"; + private const string ByInputObjectParameterSet = "ByInputObject"; + + #endregion + #region Input Parameter Definitions /// /// VaultName /// [Parameter(Mandatory = true, + ParameterSetName = ByNameParameterSet, Position = 0, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] @@ -41,6 +50,7 @@ public class GetAzureKeyVaultCertificateOperation : KeyVaultCmdletBase /// Name /// [Parameter(Mandatory = true, + ParameterSetName = ByNameParameterSet, Position = 1, ValueFromPipelineByPropertyName = true, HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate operation from vault name, currently selected environment and certificate name.")] @@ -48,10 +58,27 @@ public class GetAzureKeyVaultCertificateOperation : KeyVaultCmdletBase [Alias(Constants.CertificateName)] public string Name { get; set; } + /// + /// Certificate Object + /// + [Parameter(Mandatory = true, + ParameterSetName = ByInputObjectParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "Certificate Object.")] + [ValidateNotNullOrEmpty] + public PSKeyVaultCertificate InputObject { get; set; } + #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName.ToString(); + Name = InputObject.Name.ToString(); + } + var certificateOperation = this.DataServiceClient.GetCertificateOperation(VaultName, Name); var kvCertificateOperation = PSKeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); this.WriteObject(kvCertificateOperation); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs index 6f8cb70848c1..8ad939374245 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs @@ -30,6 +30,7 @@ public class GetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase #region Parameter Set Names private const string ByVaultAndCertNameParameterSet = "VaultAndCertName"; + private const string ByInputObjectParameterSet = "InputObject"; #endregion @@ -57,12 +58,30 @@ public class GetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase [ValidateNotNullOrEmpty] [Alias(Constants.CertificateName)] public string Name { get; set; } + + + /// + /// Certificate Object + /// + [Parameter(Mandatory = true, + ParameterSetName = ByInputObjectParameterSet, + Position = 0, + ValueFromPipeline = true, + HelpMessage = "Certificate Object.")] + [ValidateNotNullOrEmpty] + public PSKeyVaultCertificate InputObject { get; set; } #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { CertificatePolicy certificatePolicy; + if (InputObject != null) + { + VaultName = InputObject.VaultName.ToString(); + Name = InputObject.Name.ToString(); + } + try { certificatePolicy = this.DataServiceClient.GetCertificatePolicy(this.VaultName, this.Name); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs index eb8e4563b7ec..5c34342e37d1 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs @@ -1,4 +1,4 @@ -// ---------------------------------------------------------------------------------- + // ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,16 +24,19 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, "AzureKeyVaultKey", DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List), typeof(PSKeyBundle), typeof(List), typeof(DeletedKeyBundle))] + [OutputType(typeof(List), typeof(PSKeyBundle), typeof(List), typeof(PSDeletedKeyBundle))] public class GetAzureKeyVaultKey : KeyVaultCmdletBase { #region Parameter Set Names - private const string ByKeyNameParameterSet = "ByKeyName"; private const string ByVaultNameParameterSet = "ByVaultName"; + private const string ByKeyNameParameterSet = "ByKeyName"; private const string ByKeyVersionsParameterSet = "ByKeyVersions"; - private const string ByDeletedKeyParameterSet = "ByDeletedKey"; + + private const string InputObjectByVaultNameParameterSet = "ByInputObjectVaultName"; + private const string InputObjectByKeyNameParameterSet = "ByInputObjectKeyName"; + private const string InputObjectByKeyVersionsParameterSet = "ByKInputObjecteyVersions"; #endregion @@ -57,30 +60,61 @@ public class GetAzureKeyVaultKey : KeyVaultCmdletBase ValueFromPipelineByPropertyName = true, ParameterSetName = ByKeyVersionsParameterSet, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] - [Parameter(Mandatory = true, - Position = 0, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ByDeletedKeyParameterSet, - HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } + /// + /// KeyVault object + /// + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectByVaultNameParameterSet, + HelpMessage = "KeyVault object.")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectByKeyNameParameterSet, + HelpMessage = "KeyVault object.")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectByKeyVersionsParameterSet, + HelpMessage = "KeyVault object.")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + /// /// Key name. /// + [Parameter(Mandatory = false, + ParameterSetName = ByVaultNameParameterSet, + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByVaultNameParameterSet, + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] [Parameter(Mandatory = true, ParameterSetName = ByKeyNameParameterSet, Position = 1, ValueFromPipelineByPropertyName = true, HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByKeyNameParameterSet, + Position = 1, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] [Parameter(Mandatory = true, ParameterSetName = ByKeyVersionsParameterSet, Position = 1, ValueFromPipelineByPropertyName = true, HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] - [Parameter(Mandatory = false, - ParameterSetName = ByDeletedKeyParameterSet, + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByKeyVersionsParameterSet, Position = 1, ValueFromPipelineByPropertyName = true, HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] @@ -91,21 +125,32 @@ public class GetAzureKeyVaultKey : KeyVaultCmdletBase /// /// Key version. /// - [Parameter(Mandatory = false, + [Parameter(Mandatory = true, ParameterSetName = ByKeyNameParameterSet, Position = 2, ValueFromPipelineByPropertyName = true, HelpMessage = "Key version. Cmdlet constructs the FQDN of a key from vault name, currently selected environment, key name and key version.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByKeyNameParameterSet, + Position = 2, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Key version. Cmdlet constructs the FQDN of a key from vault name, currently selected environment, key name and key version.")] [Alias("KeyVersion")] public string Version { get; set; } [Parameter(Mandatory = true, ParameterSetName = ByKeyVersionsParameterSet, HelpMessage = "Specifies whether to include the versions of the key in the output.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByKeyVersionsParameterSet, + HelpMessage = "Specifies whether to include the versions of the key in the output.")] public SwitchParameter IncludeVersions { get; set; } - [Parameter(Mandatory = true, - ParameterSetName = ByDeletedKeyParameterSet, + [Parameter(Mandatory = false, + ParameterSetName = ByVaultNameParameterSet, + HelpMessage = "Specifies whether to show the previously deleted keys in the output.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByVaultNameParameterSet, HelpMessage = "Specifies whether to show the previously deleted keys in the output.")] public SwitchParameter InRemovedState { get; set; } @@ -114,35 +159,49 @@ public class GetAzureKeyVaultKey : KeyVaultCmdletBase public override void ExecuteCmdlet() { PSKeyBundle keyBundle; - switch (ParameterSetName) + + if (InputObject != null) { - case ByKeyNameParameterSet: - keyBundle = DataServiceClient.GetKey(VaultName, Name, Version ?? string.Empty); - WriteObject(keyBundle); - break; - case ByKeyVersionsParameterSet: - keyBundle = DataServiceClient.GetKey(VaultName, Name, string.Empty); - if (keyBundle != null) - { - WriteObject(new KeyIdentityItem(keyBundle)); - GetAndWriteKeyVersions(VaultName, Name, keyBundle.Version); - } - break; - case ByVaultNameParameterSet: - GetAndWriteKeys(VaultName); - break; - case ByDeletedKeyParameterSet: - if(Name == null) - { - GetAndWriteDeletedKeys(VaultName); - break; - } - DeletedKeyBundle deletedKeyBundle = DataServiceClient.GetDeletedKey(VaultName, Name); - WriteObject(deletedKeyBundle); - break; + VaultName = InputObject.VaultName.ToString(); + } - default: - throw new ArgumentException(KeyVaultProperties.Resources.BadParameterSetName); + if (!string.IsNullOrEmpty(Version)) + { + keyBundle = DataServiceClient.GetKey(VaultName, Name, Version); + WriteObject(keyBundle); + } + else if (IncludeVersions) + { + keyBundle = DataServiceClient.GetKey(VaultName, Name, string.Empty); + if (keyBundle != null) + { + WriteObject(new PSKeyIdentityItem(keyBundle)); + GetAndWriteKeyVersions(VaultName, Name, keyBundle.Version); + } + } + else if (InRemovedState) + { + if (Name == null) + { + GetAndWriteDeletedKeys(VaultName); + } + else + { + PSDeletedKeyBundle deletedKeyBundle = DataServiceClient.GetDeletedKey(VaultName, Name); + WriteObject(deletedKeyBundle); + } + } + else + { + if (string.IsNullOrEmpty(Name)) + { + GetAndWriteKeys(VaultName); + } + else + { + keyBundle = DataServiceClient.GetKey(VaultName, Name, string.Empty); + WriteObject(keyBundle); + } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs index e37cc074f72f..9b6505ae1c38 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, "AzureKeyVaultSecret", DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List), typeof(Secret), typeof(List), typeof(DeletedSecret))] + [OutputType(typeof(List), typeof(PSSecret), typeof(List), typeof(PSDeletedSecret))] public class GetAzureKeyVaultSecret : KeyVaultCmdletBase { #region Parameter Set Names @@ -32,7 +32,10 @@ public class GetAzureKeyVaultSecret : KeyVaultCmdletBase private const string ByVaultNameParameterSet = "ByVaultName"; private const string BySecretNameParameterSet = "BySecretName"; private const string BySecretVersionsParameterSet = "BySecretVersions"; - private const string ByDeletedSecretParameterSet = "ByDeletedSecrets"; + + private const string InputObjectByVaultNameParameterSet = "ByInputObjectVaultName"; + private const string InputObjectBySecretNameParameterSet = "ByInputObjectSecretName"; + private const string InputObjectBySecretVersionsParameterSet = "ByInputObjectSecretVersions"; #endregion @@ -56,31 +59,62 @@ public class GetAzureKeyVaultSecret : KeyVaultCmdletBase ValueFromPipelineByPropertyName = true, ParameterSetName = BySecretVersionsParameterSet, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] + [ValidateNotNullOrEmpty] + public string VaultName { get; set; } + + /// + /// KeyVault object + /// + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectByVaultNameParameterSet, + HelpMessage = "KeyVault Object.")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectBySecretNameParameterSet, + HelpMessage = "KeyVault Object.")] [Parameter(Mandatory = true, Position = 0, - ValueFromPipelineByPropertyName = true, - ParameterSetName = ByDeletedSecretParameterSet, - HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] + ValueFromPipeline = true, + ParameterSetName = InputObjectBySecretVersionsParameterSet, + HelpMessage = "KeyVault Object.")] [ValidateNotNullOrEmpty] - public string VaultName { get; set; } + public PSVault InputObject { get; set; } /// /// Secret name /// + [Parameter(Mandatory = false, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByVaultNameParameterSet, + HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] + [Parameter(Mandatory = false, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = InputObjectByVaultNameParameterSet, + HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = BySecretNameParameterSet, HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] + [Parameter(Mandatory = true, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = InputObjectBySecretNameParameterSet, + HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = BySecretVersionsParameterSet, HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] - [Parameter(Mandatory = false, + [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, - ParameterSetName = ByDeletedSecretParameterSet, + ParameterSetName = InputObjectBySecretVersionsParameterSet, HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] [ValidateNotNullOrEmpty] [Alias(Constants.SecretName)] @@ -89,21 +123,32 @@ public class GetAzureKeyVaultSecret : KeyVaultCmdletBase /// /// Secret version /// - [Parameter(Mandatory = false, + [Parameter(Mandatory = true, ParameterSetName = BySecretNameParameterSet, Position = 2, ValueFromPipelineByPropertyName = true, HelpMessage = "Secret version. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment, secret name and secret version.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectBySecretNameParameterSet, + Position = 2, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Secret version. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment, secret name and secret version.")] [Alias("SecretVersion")] public string Version { get; set; } [Parameter(Mandatory = true, ParameterSetName = BySecretVersionsParameterSet, HelpMessage = "Specifies whether to include the versions of the secret in the output.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectBySecretVersionsParameterSet, + HelpMessage = "Specifies whether to include the versions of the secret in the output.")] public SwitchParameter IncludeVersions { get; set; } - [Parameter(Mandatory = true, - ParameterSetName = ByDeletedSecretParameterSet, + [Parameter(Mandatory = false, + ParameterSetName = ByVaultNameParameterSet, + HelpMessage = "Specifies whether to show the previously deleted secrets in the output.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByVaultNameParameterSet, HelpMessage = "Specifies whether to show the previously deleted secrets in the output.")] public SwitchParameter InRemovedState { get; set; } @@ -111,36 +156,50 @@ public class GetAzureKeyVaultSecret : KeyVaultCmdletBase public override void ExecuteCmdlet() { - Secret secret; - switch (ParameterSetName) + PSSecret secret; + + if (InputObject != null) { - case BySecretNameParameterSet: - secret = DataServiceClient.GetSecret(VaultName, Name, Version ?? string.Empty); - WriteObject(secret); - break; - case BySecretVersionsParameterSet: - secret = DataServiceClient.GetSecret(VaultName, Name, string.Empty); - if (secret != null) - { - WriteObject(new SecretIdentityItem(secret)); - GetAndWriteSecretVersions(VaultName, Name, secret.Version); - } - break; - case ByVaultNameParameterSet: - GetAndWriteSecrets(VaultName); - break; - case ByDeletedSecretParameterSet: - if (Name == null) - { - GetAndWriteDeletedSecrets(VaultName); - break; - } - DeletedSecret deletedSecret = DataServiceClient.GetDeletedSecret(VaultName, Name); - WriteObject(deletedSecret); - break; + VaultName = InputObject.VaultName.ToString(); + } - default: - throw new ArgumentException(KeyVaultProperties.Resources.BadParameterSetName); + if (!string.IsNullOrEmpty(Version)) + { + secret = DataServiceClient.GetSecret(VaultName, Name, Version); + WriteObject(secret); + } + else if (IncludeVersions) + { + secret = DataServiceClient.GetSecret(VaultName, Name, string.Empty); + if (secret != null) + { + WriteObject(new PSSecretIdentityItem(secret)); + GetAndWriteSecretVersions(VaultName, Name, secret.Version); + } + } + else if (InRemovedState) + { + if (Name == null) + { + GetAndWriteDeletedSecrets(VaultName); + } + else + { + PSDeletedSecret deletedSecret = DataServiceClient.GetDeletedSecret(VaultName, Name); + WriteObject(deletedSecret); + } + } + else + { + if (string.IsNullOrEmpty(Name)) + { + GetAndWriteSecrets(VaultName); + } + else + { + secret = DataServiceClient.GetSecret(VaultName, Name, string.Empty); + WriteObject(secret); + } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs index f55459b6a088..50958cf96614 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs @@ -36,7 +36,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = ImportCertificateFromFileParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificate))] + [OutputType(typeof(PSKeyVaultCertificate))] public class ImportAzureKeyVaultCertificate : KeyVaultCmdletBase { #region Parameter Set Names @@ -173,7 +173,7 @@ protected override void ProcessRecord() throw new ArgumentException(KeyVaultProperties.Resources.BadParameterSetName); } - var certificate = KeyVaultCertificate.FromCertificateBundle(certBundle); + var certificate = PSKeyVaultCertificate.FromCertificateBundle(certBundle); this.WriteObject(certificate); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs index ad485ddcdd26..622d36b0ee71 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(DeletedKeyVaultCertificate))] + [OutputType(typeof(PSDeletedKeyVaultCertificate))] public class RemoveAzureKeyVaultCertificate : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -91,7 +91,7 @@ protected override void ProcessRecord() return; } - DeletedKeyVaultCertificate certBundle = null; + PSDeletedKeyVaultCertificate certBundle = null; ConfirmAction( Force.IsPresent, @@ -104,7 +104,7 @@ protected override void ProcessRecord() KeyVaultProperties.Resources.RemoveCertWhatIfMessage, Name), Name, - () => { certBundle = DeletedKeyVaultCertificate.FromDeletedCertificateBundle( this.DataServiceClient.DeleteCertificate(VaultName, Name) ); }); + () => { certBundle = PSDeletedKeyVaultCertificate.FromDeletedCertificateBundle( this.DataServiceClient.DeleteCertificate(VaultName, Name) ); }); if (PassThru.IsPresent) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs index ed70e1dfea08..4cabdbc3debd 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.KeyVault ConfirmImpact = ConfirmImpact.High, DefaultParameterSetName = DefaultParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificateIssuer))] + [OutputType(typeof(PSKeyVaultCertificateIssuer))] public class RemoveAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase { #region Parameter Set Names @@ -72,7 +72,7 @@ public class RemoveAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase #endregion protected override void ProcessRecord() { - KeyVaultCertificateIssuer issuer = null; + PSKeyVaultCertificateIssuer issuer = null; ConfirmAction( Force.IsPresent, @@ -85,7 +85,7 @@ protected override void ProcessRecord() "Remove certificate issuer '{0}'", Name), Name, - () => { issuer = KeyVaultCertificateIssuer.FromIssuer(this.DataServiceClient.DeleteCertificateIssuer(VaultName, Name)); }); + () => { issuer = PSKeyVaultCertificateIssuer.FromIssuer(this.DataServiceClient.DeleteCertificateIssuer(VaultName, Name)); }); if (PassThru) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs index 36d1448d4086..a9d4fb5fcb68 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(DeletedKeyBundle))] + [OutputType(typeof(PSDeletedKeyBundle))] public class RemoveAzureKeyVaultKey : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -87,7 +87,7 @@ public override void ExecuteCmdlet() return; } - DeletedKeyBundle deletedKeyBundle = null; + PSDeletedKeyBundle deletedKeyBundle = null; ConfirmAction( Force.IsPresent, string.Format( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs index 7392e0f7b971..a36b170de9f3 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(DeletedSecret))] + [OutputType(typeof(PSDeletedSecret))] public class RemoveAzureKeyVaultSecret : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -88,7 +88,7 @@ public override void ExecuteCmdlet() return; } - DeletedSecret deletedSecret = null; + PSDeletedSecret deletedSecret = null; ConfirmAction( Force.IsPresent, string.Format( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs index 67e59ff40ba3..24e66a4f7a61 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet( VerbsData.Restore, "AzureKeyVaultSecret", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri )] - [OutputType( typeof( Secret ) )] + [OutputType( typeof(PSSecret) )] public class RestoreAzureKeyVaultSecret : KeyVaultCmdletBase { #region Input Parameter Definitions diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs index 4fa8617323d9..7d9a99e04917 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Set, "AzureKeyVaultCertificateAttribute", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificate))] + [OutputType(typeof(PSKeyVaultCertificate))] public class SetAzureKeyVaultCertificateAttribute : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -97,7 +97,7 @@ public override void ExecuteCmdlet() if (PassThru) { - var certificate = KeyVaultCertificate.FromCertificateBundle(certificateBundle); + var certificate = PSKeyVaultCertificate.FromCertificateBundle(certificateBundle); this.WriteObject(certificate); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs index ad37fc5c207e..64766ab8c35c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs @@ -110,7 +110,7 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the certificate issuer to set.")] [ValidateNotNullOrEmpty] - public KeyVaultCertificateIssuer Issuer { get; set; } + public PSKeyVaultCertificateIssuer Issuer { get; set; } #endregion @@ -126,13 +126,13 @@ protected override void ProcessRecord() { if (ShouldProcess(Name, Properties.Resources.SetCertificateIssuer)) { - KeyVaultCertificateIssuer issuerToUse; + PSKeyVaultCertificateIssuer issuerToUse; switch (ParameterSetName) { case ExpandedParameterSet: - issuerToUse = new KeyVaultCertificateIssuer + issuerToUse = new PSKeyVaultCertificateIssuer { Name = Name, IssuerProvider = IssuerProvider, @@ -161,7 +161,7 @@ protected override void ProcessRecord() if (PassThru.IsPresent) { - this.WriteObject(KeyVaultCertificateIssuer.FromIssuer(resultantIssuer)); + this.WriteObject(PSKeyVaultCertificateIssuer.FromIssuer(resultantIssuer)); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs index 5872abae327d..8ca830bfbc9a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Set, "AzureKeyVaultSecret", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(Secret))] + [OutputType(typeof(PSSecret))] public class SetAzureKeyVaultSecret : KeyVaultCmdletBase { #region Input Parameter Definitions diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs index cc84641ee38f..7c78c95a313c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Set, "AzureKeyVaultSecretAttribute", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(Secret))] + [OutputType(typeof(PSSecret))] public class SetAzureKeyVaultSecretAttribute : KeyVaultCmdletBase { #region Input Parameter Definitions diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs index 61812e7dcba8..6509e81780be 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Undo, "AzureKeyVaultSecretRemoval", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(Secret))] + [OutputType(typeof(PSSecret))] public class UndoAzureKeyVaultSecretRemoval : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -52,7 +52,7 @@ public override void ExecuteCmdlet() { if (ShouldProcess(Name, Properties.Resources.RecoverSecret)) { - Secret secret = DataServiceClient.RecoverSecret(VaultName, Name); + PSSecret secret = DataServiceClient.RecoverSecret(VaultName, Name); WriteObject(secret); } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs index 08daeadeb538..9309da42dd24 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs @@ -32,39 +32,39 @@ public interface IKeyVaultDataServiceClient PSKeyBundle GetKey(string vaultName, string keyName, string keyVersion); - DeletedKeyBundle GetDeletedKey(string vaultName, string name); + PSDeletedKeyBundle GetDeletedKey(string vaultName, string name); - IEnumerable GetKeys(KeyVaultObjectFilterOptions options); + IEnumerable GetKeys(KeyVaultObjectFilterOptions options); - IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions options); + IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions options); - IEnumerable GetDeletedKeys(KeyVaultObjectFilterOptions options); + IEnumerable GetDeletedKeys(KeyVaultObjectFilterOptions options); - DeletedKeyBundle DeleteKey(string vaultName, string keyName); + PSDeletedKeyBundle DeleteKey(string vaultName, string keyName); void PurgeKey(string vaultName, string name); PSKeyBundle RecoverKey(string vaultName, string keyName); - Secret SetSecret(string vaultName, string secretName, SecureString secretValue, SecretAttributes secretAttributes); + PSSecret SetSecret(string vaultName, string secretName, SecureString secretValue, SecretAttributes secretAttributes); - Secret UpdateSecret(string vaultName, string secretName, string secretVersion, SecretAttributes secretAttributes); + PSSecret UpdateSecret(string vaultName, string secretName, string secretVersion, SecretAttributes secretAttributes); - Secret GetSecret(string vaultName, string secretName, string secretVersion); + PSSecret GetSecret(string vaultName, string secretName, string secretVersion); - DeletedSecret GetDeletedSecret(string vaultName, string name); + PSDeletedSecret GetDeletedSecret(string vaultName, string name); - IEnumerable GetSecrets(KeyVaultObjectFilterOptions options); + IEnumerable GetSecrets(KeyVaultObjectFilterOptions options); - IEnumerable GetSecretVersions(KeyVaultObjectFilterOptions options); + IEnumerable GetSecretVersions(KeyVaultObjectFilterOptions options); - IEnumerable GetDeletedSecrets(KeyVaultObjectFilterOptions options); + IEnumerable GetDeletedSecrets(KeyVaultObjectFilterOptions options); - DeletedSecret DeleteSecret(string vaultName, string secretName); + PSDeletedSecret DeleteSecret(string vaultName, string secretName); void PurgeSecret(string vaultName, string secretName); - Secret RecoverSecret(string vaultName, string secretName); + PSSecret RecoverSecret(string vaultName, string secretName); string BackupKey(string vaultName, string keyName, string outputBlobPath); @@ -72,7 +72,7 @@ public interface IKeyVaultDataServiceClient string BackupSecret(string vaultName, string secretName, string outputBlobPath); - Secret RestoreSecret(string vaultName, string inputBlobPath); + PSSecret RestoreSecret(string vaultName, string inputBlobPath); #region Certificate actions @@ -84,11 +84,11 @@ public interface IKeyVaultDataServiceClient DeletedCertificateBundle GetDeletedCertificate( string vaultName, string certName ); - IEnumerable GetCertificates(KeyVaultObjectFilterOptions options); + IEnumerable GetCertificates(KeyVaultObjectFilterOptions options); - IEnumerable GetDeletedCertificates( KeyVaultObjectFilterOptions options ); + IEnumerable GetDeletedCertificates( KeyVaultObjectFilterOptions options ); - IEnumerable GetCertificateVersions(KeyVaultObjectFilterOptions options); + IEnumerable GetCertificateVersions(KeyVaultObjectFilterOptions options); CertificateBundle MergeCertificate(string vaultName, string certName, X509Certificate2Collection certs, IDictionary tags); @@ -118,7 +118,7 @@ public interface IKeyVaultDataServiceClient IssuerBundle GetCertificateIssuer(string vaultName, string issuerName); - IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options); + IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options); IssuerBundle SetCertificateIssuer(string vaultName, string issuerName, string issuerProvider, string accountId, SecureString apiKey, KeyVaultCertificateOrganizationDetails organizationDetails); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs index bf0d62d33e32..dc328f24f651 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs @@ -327,7 +327,7 @@ public PSKeyBundle GetKey(string vaultName, string keyName, string keyVersion) return new PSKeyBundle(keyBundle, this.vaultUriHelper); } - public IEnumerable GetCertificates(KeyVaultObjectFilterOptions options) + public IEnumerable GetCertificates(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -347,8 +347,8 @@ public IEnumerable GetCertificates(KeyVaultObjectFilter result = this.keyVaultClient.GetCertificatesNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((certItem) => { return new CertificateIdentityItem(certItem, this.vaultUriHelper); }); + return (result == null) ? new List() : + result.Select((certItem) => { return new PSCertificateIdentityItem(certItem, this.vaultUriHelper); }); } catch (Exception ex) { @@ -356,7 +356,7 @@ public IEnumerable GetCertificates(KeyVaultObjectFilter } } - public IEnumerable GetCertificateVersions(KeyVaultObjectFilterOptions options) + public IEnumerable GetCertificateVersions(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -379,7 +379,7 @@ public IEnumerable GetCertificateVersions(KeyVaultObjec result = this.keyVaultClient.GetCertificateVersionsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return result.Select((certificateItem) => new CertificateIdentityItem(certificateItem, this.vaultUriHelper)); + return result.Select((certificateItem) => new PSCertificateIdentityItem(certificateItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -387,7 +387,7 @@ public IEnumerable GetCertificateVersions(KeyVaultObjec } } - public IEnumerable GetKeys(KeyVaultObjectFilterOptions options) + public IEnumerable GetKeys(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -407,8 +407,8 @@ public IEnumerable GetKeys(KeyVaultObjectFilterOptions options) result = this.keyVaultClient.GetKeysNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((keyItem) => new KeyIdentityItem(keyItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select((keyItem) => new PSKeyIdentityItem(keyItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -416,7 +416,7 @@ public IEnumerable GetKeys(KeyVaultObjectFilterOptions options) } } - public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions options) + public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -439,7 +439,7 @@ public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions o result = this.keyVaultClient.GetKeyVersionsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return result.Select((keyItem) => new KeyIdentityItem(keyItem, this.vaultUriHelper)); + return result.Select((keyItem) => new PSKeyIdentityItem(keyItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -447,7 +447,7 @@ public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions o } } - public DeletedKeyBundle DeleteKey(string vaultName, string keyName) + public PSDeletedKeyBundle DeleteKey(string vaultName, string keyName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -466,7 +466,7 @@ public DeletedKeyBundle DeleteKey(string vaultName, string keyName) throw GetInnerException(ex); } - return new DeletedKeyBundle(keyBundle, this.vaultUriHelper); + return new PSDeletedKeyBundle(keyBundle, this.vaultUriHelper); } public Contacts SetCertificateContacts(string vaultName, Contacts contacts) @@ -492,7 +492,7 @@ public Contacts SetCertificateContacts(string vaultName, Contacts contacts) return outputContacts; } - public Secret SetSecret(string vaultName, string secretName, SecureString secretValue, SecretAttributes secretAttributes) + public PSSecret SetSecret(string vaultName, string secretName, SecureString secretValue, SecretAttributes secretAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -518,10 +518,10 @@ public Secret SetSecret(string vaultName, string secretName, SecureString secret throw GetInnerException(ex); } - return new Secret(secret, this.vaultUriHelper); + return new PSSecret(secret, this.vaultUriHelper); } - public Secret UpdateSecret(string vaultName, string secretName, string secretVersion, SecretAttributes secretAttributes) + public PSSecret UpdateSecret(string vaultName, string secretName, string secretVersion, SecretAttributes secretAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -545,10 +545,10 @@ public Secret UpdateSecret(string vaultName, string secretName, string secretVer throw GetInnerException(ex); } - return new Secret(secret, this.vaultUriHelper); + return new PSSecret(secret, this.vaultUriHelper); } - public Secret GetSecret(string vaultName, string secretName, string secretVersion) + public PSSecret GetSecret(string vaultName, string secretName, string secretVersion) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -573,10 +573,10 @@ public Secret GetSecret(string vaultName, string secretName, string secretVersio throw GetInnerException(ex); } - return new Secret(secret, this.vaultUriHelper); + return new PSSecret(secret, this.vaultUriHelper); } - public IEnumerable GetSecrets(KeyVaultObjectFilterOptions options) + public IEnumerable GetSecrets(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -595,8 +595,8 @@ public IEnumerable GetSecrets(KeyVaultObjectFilterOptions op result = this.keyVaultClient.GetSecretsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((secretItem) => new SecretIdentityItem(secretItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select((secretItem) => new PSSecretIdentityItem(secretItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -604,7 +604,7 @@ public IEnumerable GetSecrets(KeyVaultObjectFilterOptions op } } - public IEnumerable GetSecretVersions(KeyVaultObjectFilterOptions options) + public IEnumerable GetSecretVersions(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -625,7 +625,7 @@ public IEnumerable GetSecretVersions(KeyVaultObjectFilterOpt result = this.keyVaultClient.GetSecretVersionsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return result.Select((secretItem) => new SecretIdentityItem(secretItem, this.vaultUriHelper)); + return result.Select((secretItem) => new PSSecretIdentityItem(secretItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -797,7 +797,7 @@ public CertificateOperation DeleteCertificateOperation(string vaultName, string return certificateOperation; } - public DeletedSecret DeleteSecret(string vaultName, string secretName) + public PSDeletedSecret DeleteSecret(string vaultName, string secretName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -816,7 +816,7 @@ public DeletedSecret DeleteSecret(string vaultName, string secretName) throw GetInnerException(ex); } - return new DeletedSecret(secret, this.vaultUriHelper); + return new PSDeletedSecret(secret, this.vaultUriHelper); } public string BackupKey(string vaultName, string keyName, string outputBlobPath) @@ -895,7 +895,7 @@ public string BackupSecret( string vaultName, string secretName, string outputBl return outputBlobPath; } - public Secret RestoreSecret( string vaultName, string inputBlobPath ) + public PSSecret RestoreSecret( string vaultName, string inputBlobPath ) { if ( string.IsNullOrEmpty( vaultName ) ) throw new ArgumentNullException(nameof(vaultName)); @@ -916,7 +916,7 @@ public Secret RestoreSecret( string vaultName, string inputBlobPath ) throw GetInnerException( ex ); } - return new Secret( secretBundle, this.vaultUriHelper ); + return new PSSecret( secretBundle, this.vaultUriHelper ); } public CertificatePolicy GetCertificatePolicy(string vaultName, string certificateName) @@ -1001,7 +1001,7 @@ public IssuerBundle GetCertificateIssuer(string vaultName, string issuerName) return certificateIssuer; } - public IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options) + public IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -1021,8 +1021,8 @@ public IEnumerable GetCertificateIssuers(KeyVault result = this.keyVaultClient.GetCertificateIssuersNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select(issuerItem => new CertificateIssuerIdentityItem(issuerItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select(issuerItem => new PSCertificateIssuerIdentityItem(issuerItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -1391,7 +1391,7 @@ private Exception GetInnerException(Exception exception) return exception; } - public DeletedKeyBundle GetDeletedKey(string vaultName, string keyName) + public PSDeletedKeyBundle GetDeletedKey(string vaultName, string keyName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException("vaultName"); @@ -1417,10 +1417,10 @@ public DeletedKeyBundle GetDeletedKey(string vaultName, string keyName) throw GetInnerException(ex); } - return new DeletedKeyBundle(deletedKeyBundle, this.vaultUriHelper); + return new PSDeletedKeyBundle(deletedKeyBundle, this.vaultUriHelper); } - public IEnumerable GetDeletedKeys(KeyVaultObjectFilterOptions options) + public IEnumerable GetDeletedKeys(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException("options"); @@ -1440,8 +1440,8 @@ public IEnumerable GetDeletedKeys(KeyVaultObjectFilterOp result = this.keyVaultClient.GetDeletedKeysNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((deletedKeyItem) => new DeletedKeyIdentityItem(deletedKeyItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select((deletedKeyItem) => new PSDeletedKeyIdentityItem(deletedKeyItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -1449,7 +1449,7 @@ public IEnumerable GetDeletedKeys(KeyVaultObjectFilterOp } } - public DeletedSecret GetDeletedSecret(string vaultName, string secretName) + public PSDeletedSecret GetDeletedSecret(string vaultName, string secretName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException("vaultName"); @@ -1475,10 +1475,10 @@ public DeletedSecret GetDeletedSecret(string vaultName, string secretName) throw GetInnerException(ex); } - return new DeletedSecret(deletedSecret, this.vaultUriHelper); + return new PSDeletedSecret(deletedSecret, this.vaultUriHelper); } - public IEnumerable GetDeletedSecrets(KeyVaultObjectFilterOptions options) + public IEnumerable GetDeletedSecrets(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException("options"); @@ -1497,8 +1497,8 @@ public IEnumerable GetDeletedSecrets(KeyVaultObjectFi result = this.keyVaultClient.GetDeletedSecretsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((deletedSecretItem) => new DeletedSecretIdentityItem(deletedSecretItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select((deletedSecretItem) => new PSDeletedSecretIdentityItem(deletedSecretItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -1566,7 +1566,7 @@ public PSKeyBundle RecoverKey(string vaultName, string keyName) return new PSKeyBundle(recoveredKey, this.vaultUriHelper); } - public Secret RecoverSecret(string vaultName, string secretName) + public PSSecret RecoverSecret(string vaultName, string secretName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException("vaultName"); @@ -1585,7 +1585,7 @@ public Secret RecoverSecret(string vaultName, string secretName) throw GetInnerException(ex); } - return new Secret(recoveredSecret, this.vaultUriHelper); + return new PSSecret(recoveredSecret, this.vaultUriHelper); } public DeletedCertificateBundle GetDeletedCertificate( string vaultName, string certName ) @@ -1617,7 +1617,7 @@ public DeletedCertificateBundle GetDeletedCertificate( string vaultName, string return deletedCertificate; } - public IEnumerable GetDeletedCertificates( KeyVaultObjectFilterOptions options ) + public IEnumerable GetDeletedCertificates( KeyVaultObjectFilterOptions options ) { if ( options == null ) throw new ArgumentNullException( nameof( options ) ); @@ -1636,8 +1636,8 @@ public IEnumerable GetDeletedCertificates( KeyVa result = this.keyVaultClient.GetDeletedCertificatesNextAsync( options.NextLink ).GetAwaiter( ).GetResult( ); options.NextLink = result.NextPageLink; - return ( result == null ) ? new List( ) : - result.Select( ( deletedItem ) => new DeletedCertificateIdentityItem( deletedItem, this.vaultUriHelper ) ); + return ( result == null ) ? new List( ) : + result.Select( ( deletedItem ) => new PSDeletedCertificateIdentityItem( deletedItem, this.vaultUriHelper ) ); } catch ( Exception ex ) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/CertificateIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIdentityItem.cs similarity index 92% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/CertificateIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIdentityItem.cs index f34854c0d725..478ba4321f42 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/CertificateIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIdentityItem.cs @@ -19,9 +19,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class CertificateIdentityItem : ObjectIdentifier + public class PSCertificateIdentityItem : ObjectIdentifier { - internal CertificateIdentityItem(CertificateItem certItem, VaultUriHelper vaultUriHelper) + internal PSCertificateIdentityItem(CertificateItem certItem, VaultUriHelper vaultUriHelper) { if (certItem == null) throw new ArgumentNullException("certItem"); @@ -40,7 +40,7 @@ internal CertificateIdentityItem(CertificateItem certItem, VaultUriHelper vaultU Tags = (certItem.Tags == null) ? null : certItem.Tags.ConvertToHashtable(); } - internal CertificateIdentityItem(CertificateBundle certBundle) + internal PSCertificateIdentityItem(CertificateBundle certBundle) { if (certBundle == null) throw new ArgumentNullException("certBundle"); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/CertificateIssuerIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs similarity index 86% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/CertificateIssuerIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs index fa1e6dac432d..e97fa39e302a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/CertificateIssuerIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs @@ -18,9 +18,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class CertificateIssuerIdentityItem + public class PSCertificateIssuerIdentityItem { - internal CertificateIssuerIdentityItem(CertificateIssuerItem issuerItem, VaultUriHelper vaultUriHelper) + internal PSCertificateIssuerIdentityItem(CertificateIssuerItem issuerItem, VaultUriHelper vaultUriHelper) { if (issuerItem == null) throw new ArgumentNullException("issuerItem"); @@ -29,7 +29,7 @@ internal CertificateIssuerIdentityItem(CertificateIssuerItem issuerItem, VaultUr IssuerProvider = issuerItem.Provider; } - internal CertificateIssuerIdentityItem(IssuerBundle issuer) + internal PSCertificateIssuerIdentityItem(IssuerBundle issuer) { if (issuer == null) throw new ArgumentNullException("issuer"); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedCertificateIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedCertificateIdentityItem.cs similarity index 82% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedCertificateIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedCertificateIdentityItem.cs index 4c95fef5c2fa..8904eb2a7ff1 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedCertificateIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedCertificateIdentityItem.cs @@ -17,16 +17,16 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class DeletedCertificateIdentityItem : CertificateIdentityItem + public class PSDeletedCertificateIdentityItem : PSCertificateIdentityItem { - internal DeletedCertificateIdentityItem( DeletedCertificateItem certItem, VaultUriHelper vaultUriHelper ) + internal PSDeletedCertificateIdentityItem( DeletedCertificateItem certItem, VaultUriHelper vaultUriHelper ) :base(certItem, vaultUriHelper) { ScheduledPurgeDate = certItem.ScheduledPurgeDate; DeletedDate = certItem.DeletedDate; } - internal DeletedCertificateIdentityItem( DeletedCertificateBundle certBundle ) + internal PSDeletedCertificateIdentityItem( DeletedCertificateBundle certBundle ) :base( certBundle ) { ScheduledPurgeDate = certBundle.ScheduledPurgeDate; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyBundle.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyBundle.cs similarity index 81% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyBundle.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyBundle.cs index 792f4339709c..86dbe02bf35c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyBundle.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyBundle.cs @@ -16,12 +16,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class DeletedKeyBundle : PSKeyBundle + public class PSDeletedKeyBundle : PSKeyBundle { - public DeletedKeyBundle() + public PSDeletedKeyBundle() { } - internal DeletedKeyBundle(Azure.KeyVault.Models.DeletedKeyBundle deletedKeyBundle, VaultUriHelper vaultUriHelper) : base(deletedKeyBundle, vaultUriHelper) + internal PSDeletedKeyBundle(Azure.KeyVault.Models.DeletedKeyBundle deletedKeyBundle, VaultUriHelper vaultUriHelper) : base(deletedKeyBundle, vaultUriHelper) { ScheduledPurgeDate = deletedKeyBundle.ScheduledPurgeDate; DeletedDate = deletedKeyBundle.DeletedDate; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyIdentityItem.cs similarity index 80% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyIdentityItem.cs index 2bac9ab759a7..64cdad7056a9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyIdentityItem.cs @@ -16,15 +16,15 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class DeletedKeyIdentityItem : KeyIdentityItem + public class PSDeletedKeyIdentityItem : PSKeyIdentityItem { - internal DeletedKeyIdentityItem(Azure.KeyVault.Models.DeletedKeyItem keyItem, VaultUriHelper vaultUriHelper) : base(keyItem, vaultUriHelper) + internal PSDeletedKeyIdentityItem(Azure.KeyVault.Models.DeletedKeyItem keyItem, VaultUriHelper vaultUriHelper) : base(keyItem, vaultUriHelper) { ScheduledPurgeDate = keyItem.ScheduledPurgeDate; DeletedDate = keyItem.DeletedDate; } - internal DeletedKeyIdentityItem(DeletedKeyBundle keyBundle) : base(keyBundle) + internal PSDeletedKeyIdentityItem(PSDeletedKeyBundle keyBundle) : base(keyBundle) { ScheduledPurgeDate = keyBundle.ScheduledPurgeDate; DeletedDate = keyBundle.DeletedDate; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificate.cs similarity index 77% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyVaultCertificate.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificate.cs index feed2109eb85..5cd83dbe3cfc 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificate.cs @@ -16,9 +16,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public sealed class DeletedKeyVaultCertificate : KeyVaultCertificate + public sealed class PSDeletedKeyVaultCertificate : PSKeyVaultCertificate { - public DeletedKeyVaultCertificate( Azure.KeyVault.Models.DeletedCertificateBundle deletedCertificateBundle ) + public PSDeletedKeyVaultCertificate( Azure.KeyVault.Models.DeletedCertificateBundle deletedCertificateBundle ) :base( deletedCertificateBundle ) { if ( deletedCertificateBundle == null ) @@ -30,14 +30,14 @@ public DeletedKeyVaultCertificate( Azure.KeyVault.Models.DeletedCertificateBundl DeletedDate = deletedCertificateBundle.DeletedDate; } - internal static DeletedKeyVaultCertificate FromDeletedCertificateBundle( Azure.KeyVault.Models.DeletedCertificateBundle deletedCertificateBundle ) + internal static PSDeletedKeyVaultCertificate FromDeletedCertificateBundle( Azure.KeyVault.Models.DeletedCertificateBundle deletedCertificateBundle ) { if ( deletedCertificateBundle == null ) { return null; } - return new DeletedKeyVaultCertificate( deletedCertificateBundle ); + return new PSDeletedKeyVaultCertificate( deletedCertificateBundle ); } public DateTime? ScheduledPurgeDate { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecret.cs similarity index 85% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedSecret.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecret.cs index ad54d5536e88..eab45415cb2e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecret.cs @@ -17,9 +17,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class DeletedSecret : Secret + public class PSDeletedSecret : PSSecret { - public DeletedSecret() + public PSDeletedSecret() { } /// @@ -27,7 +27,7 @@ public DeletedSecret() /// /// secret returned from service /// helper class - internal DeletedSecret(Azure.KeyVault.Models.DeletedSecretBundle deletedSecret, VaultUriHelper vaultUriHelper) : base(deletedSecret, vaultUriHelper) + internal PSDeletedSecret(Azure.KeyVault.Models.DeletedSecretBundle deletedSecret, VaultUriHelper vaultUriHelper) : base(deletedSecret, vaultUriHelper) { ScheduledPurgeDate = deletedSecret.ScheduledPurgeDate; DeletedDate = deletedSecret.DeletedDate; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedSecretIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecretIdentityItem.cs similarity index 79% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedSecretIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecretIdentityItem.cs index 7901b0eac517..e04ec90c4bd1 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/DeletedSecretIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecretIdentityItem.cs @@ -16,15 +16,15 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class DeletedSecretIdentityItem : SecretIdentityItem + public class PSDeletedSecretIdentityItem : PSSecretIdentityItem { - internal DeletedSecretIdentityItem(Azure.KeyVault.Models.DeletedSecretItem secretItem, VaultUriHelper vaultUriHelper) : base(secretItem, vaultUriHelper) + internal PSDeletedSecretIdentityItem(Azure.KeyVault.Models.DeletedSecretItem secretItem, VaultUriHelper vaultUriHelper) : base(secretItem, vaultUriHelper) { ScheduledPurgeDate = secretItem.ScheduledPurgeDate; DeletedDate = secretItem.DeletedDate; } - internal DeletedSecretIdentityItem(DeletedSecret secret) : base(secret) + internal PSDeletedSecretIdentityItem(PSDeletedSecret secret) : base(secret) { ScheduledPurgeDate = secret.ScheduledPurgeDate; DeletedDate = secret.DeletedDate; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyIdentityItem.cs similarity index 93% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyIdentityItem.cs index f7310d2f929c..d6e99c05f3f9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyIdentityItem.cs @@ -18,9 +18,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class KeyIdentityItem : ObjectIdentifier + public class PSKeyIdentityItem : ObjectIdentifier { - internal KeyIdentityItem(Azure.KeyVault.Models.KeyItem keyItem, VaultUriHelper vaultUriHelper) + internal PSKeyIdentityItem(Azure.KeyVault.Models.KeyItem keyItem, VaultUriHelper vaultUriHelper) { if (keyItem == null) throw new ArgumentNullException("keyItem"); @@ -40,7 +40,7 @@ internal KeyIdentityItem(Azure.KeyVault.Models.KeyItem keyItem, VaultUriHelper v Tags = (keyItem.Tags == null) ? null : keyItem.Tags.ConvertToHashtable(); } - internal KeyIdentityItem(PSKeyBundle keyBundle) + internal PSKeyIdentityItem(PSKeyBundle keyBundle) { if (keyBundle == null) throw new ArgumentNullException("keyBundle"); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificate.cs similarity index 88% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificate.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificate.cs index 6420c5dde727..e8a59269848e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificate.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class KeyVaultCertificate + public class PSKeyVaultCertificate { public string Name { get; set; } public string VaultName { get; set; } @@ -36,7 +36,7 @@ public class KeyVaultCertificate public string RecoveryLevel { get; private set; } - public KeyVaultCertificate( CertificateBundle certificateBundle ) + public PSKeyVaultCertificate( CertificateBundle certificateBundle ) { if ( certificateBundle == null ) { @@ -85,24 +85,24 @@ public KeyVaultCertificate( CertificateBundle certificateBundle ) } } - internal static KeyVaultCertificate FromCertificateBundle(CertificateBundle certificateBundle) + internal static PSKeyVaultCertificate FromCertificateBundle(CertificateBundle certificateBundle) { if ( certificateBundle == null ) { return null; } - return new KeyVaultCertificate( certificateBundle ); + return new PSKeyVaultCertificate( certificateBundle ); } - internal static List FromCertificateBundles(IEnumerable certificateBundles) + internal static List FromCertificateBundles(IEnumerable certificateBundles) { if (certificateBundles == null || certificateBundles.Count() == 0) { return null; } - return certificateBundles.Select(certificateBundle => KeyVaultCertificate.FromCertificateBundle(certificateBundle)).ToList(); + return certificateBundles.Select(certificateBundle => PSKeyVaultCertificate.FromCertificateBundle(certificateBundle)).ToList(); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs similarity index 90% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateIssuer.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs index 7e44bb9e56b7..0b3b2426c6cd 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs @@ -17,7 +17,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class KeyVaultCertificateIssuer + public class PSKeyVaultCertificateIssuer { public string Name { get; set; } public string IssuerProvider { get; set; } @@ -25,14 +25,14 @@ public class KeyVaultCertificateIssuer public SecureString ApiKey { get; set; } public KeyVaultCertificateOrganizationDetails OrganizationDetails { get; set; } - internal static KeyVaultCertificateIssuer FromIssuer(IssuerBundle issuer) + internal static PSKeyVaultCertificateIssuer FromIssuer(IssuerBundle issuer) { if (issuer == null) { return null; } - var kvcIssuer = new KeyVaultCertificateIssuer + var kvcIssuer = new PSKeyVaultCertificateIssuer { Name = issuer.IssuerIdentifier.Name, IssuerProvider = issuer.Provider, diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/Secret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs similarity index 92% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/Secret.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs index 5a094251d599..5e059b36ad9a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/Secret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs @@ -17,9 +17,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class Secret : ObjectIdentifier + public class PSSecret : ObjectIdentifier { - public Secret() + public PSSecret() { } /// @@ -27,7 +27,7 @@ public Secret() /// /// secret returned from service /// helper class - internal Secret(Azure.KeyVault.Models.SecretBundle secret, VaultUriHelper vaultUriHelper) + internal PSSecret(Azure.KeyVault.Models.SecretBundle secret, VaultUriHelper vaultUriHelper) { if (secret == null) throw new ArgumentNullException("secret"); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/SecretIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretIdentityItem.cs similarity index 92% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/SecretIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretIdentityItem.cs index b43a694d491c..2843ebe7843c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/SecretIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretIdentityItem.cs @@ -18,9 +18,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class SecretIdentityItem : ObjectIdentifier + public class PSSecretIdentityItem : ObjectIdentifier { - internal SecretIdentityItem(Azure.KeyVault.Models.SecretItem secretItem, VaultUriHelper vaultUriHelper) + internal PSSecretIdentityItem(Azure.KeyVault.Models.SecretItem secretItem, VaultUriHelper vaultUriHelper) { if (secretItem == null) throw new ArgumentNullException("secretItem"); @@ -39,7 +39,7 @@ internal SecretIdentityItem(Azure.KeyVault.Models.SecretItem secretItem, VaultUr Tags = (secretItem.Tags == null) ? null : secretItem.Tags.ConvertToHashtable(); } - internal SecretIdentityItem(Secret secret) + internal PSSecretIdentityItem(PSSecret secret) { if (secret == null) throw new ArgumentNullException("secret"); From 150e4457bf4a17140f08b741237ddd607e43c602 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Thu, 22 Feb 2018 15:39:31 -0800 Subject: [PATCH 03/19] more changes --- .../Commands.KeyVault.csproj | 4 +- .../Commands/AddAzureKeyVaultKey.cs | 5 +- .../Commands/BackupAzureKeyVaultKey.cs | 4 +- .../Commands/BackupAzureKeyVaultSecret.cs | 4 +- .../Commands/GetAzureKeyVault.cs | 4 +- .../Commands/GetAzureKeyVaultCertificate.cs | 3 - .../Commands/GetAzureKeyVaultKey.cs | 2 - .../Commands/GetAzureKeyVaultSecret.cs | 2 - .../ImportAzureKeyVaultCertificate.cs | 57 +++-- .../Commands/NewAzureKeyVault.cs | 22 +- ...KeyVaultCertificateAdministratorDetails.cs | 10 +- ...eKeyVaultCertificateOrganizationDetails.cs | 11 +- .../NewAzureKeyVaultCertificatePolicy.cs | 212 +++++++++--------- .../SetAzureKeyVaultCertificateIssuer.cs | 2 +- .../Models/IKeyVaultDataServiceClient.cs | 2 +- .../Models/KeyVaultDataServiceClient.cs | 2 +- ...eyVaultCertificateAdministratorDetails.cs} | 12 +- .../Models/PSKeyVaultCertificateIssuer.cs | 4 +- ...KeyVaultCertificateOrganizationDetails.cs} | 12 +- 19 files changed, 190 insertions(+), 184 deletions(-) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyVaultCertificateAdministratorDetails.cs => PSKeyVaultCertificateAdministratorDetails.cs} (79%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyVaultCertificateOrganizationDetails.cs => PSKeyVaultCertificateOrganizationDetails.cs} (68%) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj index 6be6441e1865..055411131d62 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj @@ -104,11 +104,11 @@ - + - + diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs index 15e52c18cd75..2de6489af463 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs @@ -13,14 +13,13 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.KeyVault.Models; +using Microsoft.Azure.Commands.KeyVault.Properties; using Microsoft.Azure.KeyVault.WebKey; -using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; using System; using System.Collections; using System.IO; using System.Management.Automation; using System.Security; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { @@ -241,7 +240,7 @@ internal JsonWebKey CreateWebKeyFromFile() FileInfo keyFile = new FileInfo(this.GetUnresolvedProviderPathFromPSPath(this.KeyFilePath)); if (!keyFile.Exists) { - throw new FileNotFoundException(string.Format(KeyVaultProperties.Resources.KeyFileNotFound, this.KeyFilePath)); + throw new FileNotFoundException(string.Format(Resources.KeyFileNotFound, this.KeyFilePath)); } var converterChain = WebKeyConverterFactory.CreateConverterChain(); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs index 7f5aa865bb89..49ed22b302b9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs @@ -16,7 +16,7 @@ using System.Management.Automation; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.KeyVault.Models; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { @@ -122,7 +122,7 @@ public override void ExecuteCmdlet() // deny request if the file exists and overwrite is not authorized if ( !AzureSession.Instance.DataStore.FileExists( filePath ) || Force.IsPresent - || ShouldContinue( string.Format( KeyVaultProperties.Resources.FileOverwriteMessage, filePath ), KeyVaultProperties.Resources.FileOverwriteCaption ) ) + || ShouldContinue( string.Format(Resources.FileOverwriteMessage, filePath ), Resources.FileOverwriteCaption ) ) { var backupBlobPath = this.DataServiceClient.BackupKey(VaultName, Name, filePath); this.WriteObject( backupBlobPath ); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs index 06f65dd58c39..5bb012cfcc5a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs @@ -16,7 +16,7 @@ using System.Management.Automation; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.KeyVault.Models; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { @@ -122,7 +122,7 @@ public override void ExecuteCmdlet( ) // deny request if the file exists and overwrite is not authorized if ( !AzureSession.Instance.DataStore.FileExists( filePath ) || Force.IsPresent - || ShouldContinue( string.Format( KeyVaultProperties.Resources.FileOverwriteMessage, filePath ), KeyVaultProperties.Resources.FileOverwriteCaption ) ) + || ShouldContinue( string.Format(Resources.FileOverwriteMessage, filePath ), Resources.FileOverwriteCaption ) ) { var backupBlobPath = this.DataServiceClient.BackupSecret(VaultName, Name, filePath); this.WriteObject( backupBlobPath ); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs index a6170c7cec67..d3c39e37652d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs @@ -18,7 +18,7 @@ using System.Collections.Generic; using System.Management.Automation; using Microsoft.Azure.Commands.KeyVault.Models; -using PSKeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { @@ -133,7 +133,7 @@ public override void ExecuteCmdlet() break; default: - throw new ArgumentException(PSKeyVaultProperties.Resources.BadParameterSetName); + throw new ArgumentException(Resources.BadParameterSetName); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs index 5048e9f834b9..2d447d357a02 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs @@ -12,14 +12,11 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; using Microsoft.Azure.Commands.KeyVault.Models; using Microsoft.Azure.KeyVault.Models; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; -using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; namespace Microsoft.Azure.Commands.KeyVault { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs index 5c34342e37d1..f8bd09d38187 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs @@ -13,11 +13,9 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.KeyVault.Models; -using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs index 9b6505ae1c38..2bf0705d08ec 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs @@ -13,11 +13,9 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.KeyVault.Models; -using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs index 50958cf96614..354752e2f5d2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs @@ -42,7 +42,6 @@ public class ImportAzureKeyVaultCertificate : KeyVaultCmdletBase #region Parameter Set Names private const string ImportCertificateFromFileParameterSet = "ImportCertificateFromFile"; - private const string ImportWithPrivateKeyFromFileParameterSet = "ImportWithPrivateKeyFromFile"; private const string ImportWithPrivateKeyFromCollectionParameterSet = "ImportWithPrivateKeyFromCollection"; private const string ImportWithPrivateKeyFromStringParameterSet = "ImportWithPrivateKeyFromString"; @@ -75,17 +74,16 @@ public class ImportAzureKeyVaultCertificate : KeyVaultCmdletBase /// File Path /// [Parameter(Mandatory = true, + Position = 2, ParameterSetName = ImportCertificateFromFileParameterSet, HelpMessage = "Specifies the path to the file that contains the certificate to add to key vault.")] - [Parameter(Mandatory = true, - ParameterSetName = ImportWithPrivateKeyFromFileParameterSet, - HelpMessage = "Specifies the path to the file that contains the certificate and private key to add to key vault.")] public string FilePath { get; set; } /// /// Certificate as a string /// [Parameter(Mandatory = true, + Position = 2, ParameterSetName = ImportWithPrivateKeyFromStringParameterSet, HelpMessage = "The certificate and private key to add to key vault as a string.")] public string CertificateString { get; set; } @@ -94,7 +92,7 @@ public class ImportAzureKeyVaultCertificate : KeyVaultCmdletBase /// Password /// [Parameter(Mandatory = false, - ParameterSetName = ImportWithPrivateKeyFromFileParameterSet, + ParameterSetName = ImportCertificateFromFileParameterSet, HelpMessage = "Specifies the password for the certificate and private key file to import.")] [Parameter(Mandatory = false, ParameterSetName = ImportWithPrivateKeyFromStringParameterSet, @@ -105,8 +103,11 @@ public class ImportAzureKeyVaultCertificate : KeyVaultCmdletBase /// Certificate Collection /// [Parameter(Mandatory = true, + Position = 2, + ValueFromPipeline = true, ParameterSetName = ImportWithPrivateKeyFromCollectionParameterSet, HelpMessage = "Specifies the certificate collection to add to key vault.")] + [Alias("InputObject")] public X509Certificate2Collection CertificateCollection { get; set; } /// @@ -119,7 +120,7 @@ public class ImportAzureKeyVaultCertificate : KeyVaultCmdletBase #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { if (ShouldProcess(Name, Properties.Resources.ImportCertificate)) { @@ -130,32 +131,33 @@ protected override void ProcessRecord() { case ImportCertificateFromFileParameterSet: - certBundle = this.DataServiceClient.MergeCertificate( - VaultName, - Name, - LoadCertificateFromFile(), - Tag == null ? null : Tag.ConvertToDictionary()); - - break; + if (Password != null) + { + X509Certificate2Collection userProvidedCertColl = InitializeCertificateCollection(); + X509Certificate2Collection certColl = new X509Certificate2Collection(); - case ImportWithPrivateKeyFromFileParameterSet: + byte[] base64Bytes; - X509Certificate2Collection userProvidedCertColl = InitializeCertificateCollection(); - X509Certificate2Collection certColl = new X509Certificate2Collection(); + if (Password == null) + { + base64Bytes = userProvidedCertColl.Export(X509ContentType.Pfx); + } + else + { + base64Bytes = userProvidedCertColl.Export(X509ContentType.Pfx, Password.ConvertToString()); + } - byte[] base64Bytes; + string base64CertCollection = Convert.ToBase64String(base64Bytes); + certBundle = this.DataServiceClient.ImportCertificate(VaultName, Name, base64CertCollection, Password, Tag == null ? null : Tag.ConvertToDictionary()); - if (Password == null) - { - base64Bytes = userProvidedCertColl.Export(X509ContentType.Pfx); - } - else - { - base64Bytes = userProvidedCertColl.Export(X509ContentType.Pfx, Password.ConvertToString()); + break; } - string base64CertCollection = Convert.ToBase64String(base64Bytes); - certBundle = this.DataServiceClient.ImportCertificate(VaultName, Name, base64CertCollection, Password, Tag == null ? null : Tag.ConvertToDictionary()); + certBundle = this.DataServiceClient.MergeCertificate( + VaultName, + Name, + LoadCertificateFromFile(), + Tag == null ? null : Tag.ConvertToDictionary()); break; @@ -168,9 +170,6 @@ protected override void ProcessRecord() certBundle = this.DataServiceClient.ImportCertificate(VaultName, Name, CertificateString, Password, Tag == null ? null : Tag.ConvertToDictionary()); break; - - default: - throw new ArgumentException(KeyVaultProperties.Resources.BadParameterSetName); } var certificate = PSKeyVaultCertificate.FromCertificateBundle(certBundle); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVault.cs index b589f1289d40..dc34bfa9086a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVault.cs @@ -12,13 +12,13 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.KeyVault.Models; +using Microsoft.Azure.Commands.KeyVault.Properties; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.KeyVault.Models; using System; using System.Collections; using System.Management.Automation; -using PSKeyVaultModels = Microsoft.Azure.Commands.KeyVault.Models; -using PSKeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { @@ -28,7 +28,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.New, "AzureRmKeyVault", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSKeyVaultModels.PSVault))] + [OutputType(typeof(PSVault))] public class NewAzureKeyVault : KeyVaultManagementCmdletBase { #region Input Parameter Definitions @@ -43,7 +43,8 @@ public class NewAzureKeyVault : KeyVaultManagementCmdletBase "Specifies a name of the key vault to create. The name can be any combination of letters, digits, or hyphens. The name must start and end with a letter or digit. The name must be universally unique." )] [ValidateNotNullOrEmpty] - public string VaultName { get; set; } + [Alias("VaultName")] + public string Name { get; set; } /// /// Resource group name @@ -102,11 +103,11 @@ public class NewAzureKeyVault : KeyVaultManagementCmdletBase public override void ExecuteCmdlet() { - if (ShouldProcess(VaultName, Properties.Resources.CreateKeyVault)) + if (ShouldProcess(Name, Properties.Resources.CreateKeyVault)) { - if (VaultExistsInCurrentSubscription(this.VaultName)) + if (VaultExistsInCurrentSubscription(Name)) { - throw new ArgumentException(PSKeyVaultProperties.Resources.VaultAlreadyExists); + throw new ArgumentException(Resources.VaultAlreadyExists); } var userObjectId = string.Empty; @@ -122,6 +123,7 @@ public override void ExecuteCmdlet() // This is to unblock Key Vault in Fairfax as Graph has issues in this environment. WriteWarning(ex.Message); } + if (!string.IsNullOrWhiteSpace(userObjectId)) { accessPolicy = new AccessPolicyEntry() @@ -138,9 +140,9 @@ public override void ExecuteCmdlet() }; } - var newVault = KeyVaultManagementClient.CreateNewVault(new PSKeyVaultModels.VaultCreationParameters() + var newVault = KeyVaultManagementClient.CreateNewVault(new VaultCreationParameters() { - VaultName = this.VaultName, + VaultName = this.Name, ResourceGroupName = this.ResourceGroupName, Location = this.Location, EnabledForDeployment = this.EnabledForDeployment.IsPresent, @@ -160,7 +162,7 @@ public override void ExecuteCmdlet() if (accessPolicy == null) { - WriteWarning(PSKeyVaultProperties.Resources.VaultNoAccessPolicyWarning); + WriteWarning(Resources.VaultNoAccessPolicyWarning); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateAdministratorDetails.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateAdministratorDetails.cs index bd745fb0a36e..84af746c9e06 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateAdministratorDetails.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateAdministratorDetails.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Commands [Cmdlet(VerbsCommon.New, CmdletNoun.AzureKeyVaultCertificateAdministratorDetails, SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificateAdministratorDetails))] + [OutputType(typeof(PSKeyVaultCertificateAdministratorDetails))] public class NewAzureKeyVaultCertificateAdministratorDetails : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -32,6 +32,7 @@ public class NewAzureKeyVaultCertificateAdministratorDetails : KeyVaultCmdletBas /// FirstName /// [Parameter(ValueFromPipelineByPropertyName = true, + Mandatory = false, HelpMessage = "Specifies the first name of the administrator.")] public string FirstName { get; set; } @@ -39,6 +40,7 @@ public class NewAzureKeyVaultCertificateAdministratorDetails : KeyVaultCmdletBas /// LastName /// [Parameter(ValueFromPipelineByPropertyName = true, + Mandatory = false, HelpMessage = "Specifies the last name of the administrator.")] public string LastName { get; set; } @@ -46,6 +48,7 @@ public class NewAzureKeyVaultCertificateAdministratorDetails : KeyVaultCmdletBas /// EmailAddress /// [Parameter(ValueFromPipelineByPropertyName = true, + Mandatory = false, HelpMessage = "Specifies the email address of the administrator.")] public string EmailAddress { get; set; } @@ -53,16 +56,17 @@ public class NewAzureKeyVaultCertificateAdministratorDetails : KeyVaultCmdletBas /// PhoneNumber /// [Parameter(ValueFromPipelineByPropertyName = true, + Mandatory = false, HelpMessage = "Specifies the phone number of the administrator.")] public string PhoneNumber { get; set; } #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { if (ShouldProcess(string.Empty, Properties.Resources.CreateCertificateAdministrator)) { - var adminDetails = new KeyVaultCertificateAdministratorDetails + var adminDetails = new PSKeyVaultCertificateAdministratorDetails { FirstName = FirstName, LastName = LastName, diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateOrganizationDetails.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateOrganizationDetails.cs index 41e1f1cab843..bb1055448752 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateOrganizationDetails.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateOrganizationDetails.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Commands [Cmdlet(VerbsCommon.New, CmdletNoun.AzureKeyVaultCertificateOrganizationDetails, SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(KeyVaultCertificateOrganizationDetails))] + [OutputType(typeof(PSKeyVaultCertificateOrganizationDetails))] public class NewAzureKeyVaultCertificateOrganizationDetails : KeyVaultCmdletBase { #region Input Parameter Definitions @@ -39,17 +39,18 @@ public class NewAzureKeyVaultCertificateOrganizationDetails : KeyVaultCmdletBase /// /// AdministratorDetails /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipeline = true, HelpMessage = "Specifies the details of the administrators for the organization.")] - public List AdministratorDetails { get; set; } + public List AdministratorDetails { get; set; } #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { if (ShouldProcess(string.Empty, Properties.Resources.CreateCertificateAdministrator)) { - var organizationDetails = new KeyVaultCertificateOrganizationDetails + var organizationDetails = new PSKeyVaultCertificateOrganizationDetails { Id = Id, AdministratorDetails = AdministratorDetails, diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs index 387ec200e19e..5b760a99dcf1 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs @@ -15,7 +15,6 @@ using Microsoft.Azure.Commands.KeyVault.Models; using System; using System.Collections.Generic; -using System.Globalization; using System.Management.Automation; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; @@ -27,16 +26,102 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsCommon.New, CmdletNoun.AzureKeyVaultCertificatePolicy, SupportsShouldProcess = true, + DefaultParameterSetName = SubjectNameRenewNumberParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSKeyVaultCertificatePolicy))] public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string SubjectNameRenewNumberParameterSet = "SubjectNameWithRenewDays"; + private const string DNSNamesRenewNumberParameterSet = "DNSNamesWithRenewDays"; + private const string SubjectNameRenewPercentParameterSet = "SubjectNameWithRenewPercent"; + private const string DNSNamesRenewPercentParameterSet = "DNSNamesWithRenewPercent"; + + #endregion + #region Input Parameter Definitions + /// + /// IssuerName + /// + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the issuer for this certificate.")] + public string IssuerName { get; set; } + + /// + /// SubjectName + /// + [Parameter(Mandatory = true, + Position = 1, + ParameterSetName = SubjectNameRenewNumberParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the subject name of the certificate.")] + [Parameter(Mandatory = true, + Position = 1, + ParameterSetName = SubjectNameRenewPercentParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the subject name of the certificate.")] + [Parameter(Mandatory = false, + ParameterSetName = DNSNamesRenewNumberParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the subject name of the certificate.")] + [Parameter(Mandatory = false, + ParameterSetName = DNSNamesRenewPercentParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the subject name of the certificate.")] + public string SubjectName { get; set; } + + /// + /// DnsNames + /// + [Parameter(Mandatory = true, + Position = 1, + ParameterSetName = DNSNamesRenewNumberParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the DNS names in the certificate.")] + [Parameter(Mandatory = true, + Position = 1, + ParameterSetName = DNSNamesRenewPercentParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the DNS names in the certificate.")] + public List DnsNames { get; set; } + + /// + /// RenewAtNumberOfDaysBeforeExpiry + /// + [Parameter(Mandatory = false, + ParameterSetName = DNSNamesRenewNumberParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies how many days before expiry the automatic certificate renewal process begins.")] + [Parameter(Mandatory = false, + ParameterSetName = SubjectNameRenewNumberParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies how many days before expiry the automatic certificate renewal process begins.")] + [ValidateRange(1, int.MaxValue)] + public int? RenewAtNumberOfDaysBeforeExpiry { get; set; } + + /// + /// RenewAtPercentageLifetime + /// + [Parameter(Mandatory = true, + ParameterSetName = DNSNamesRenewPercentParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the percentage of the lifetime after which the automatic process for the certificate renewal begins.")] + [Parameter(Mandatory = true, + ParameterSetName = SubjectNameRenewPercentParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the percentage of the lifetime after which the automatic process for the certificate renewal begins.")] + [ValidateRange(0, 99)] + public int? RenewAtPercentageLifetime { get; set; } + /// /// SecretContentType /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the content type of the resulting Key Vault secret.")] [ValidateSet(Constants.Pkcs12ContentType, Constants.PemContentType)] public string SecretContentType { get; set; } @@ -44,99 +129,72 @@ public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// /// ReuseKeyOnRenewal /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies whether the certificate should use the old key during renewal.")] public SwitchParameter ReuseKeyOnRenewal { get; set; } /// /// ReuseKeyOnRenewal /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies whether the certificate policy is enabled or not.")] public SwitchParameter Disabled { get; set; } - /// - /// SubjectName - /// - [Parameter(ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the subject name of the certificate.")] - public string SubjectName { get; set; } - - /// - /// DnsNames - /// - [Parameter(ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the DNS names in the certificate.")] - public List DnsNames { get; set; } - /// /// Key Usage /// - [Parameter(ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the key usages in the certificate.")] + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the key usages in the certificate.")] public List KeyUsage { get; set; } /// /// Ekus /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the enhanced key usages in the certificate.")] public List Ekus { get; set; } /// /// ValidityInMonths /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the number of months the certificate will be valid.")] public int? ValidityInMonths { get; set; } - /// - /// IssuerName - /// - [Parameter(ValueFromPipelineByPropertyName = true, - Mandatory = true, - HelpMessage = "Specifies the name of the issuer for this certificate.")] - public string IssuerName { get; set; } - /// /// CertificateType /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the type of certificate to the issuer.")] public string CertificateType { get; set; } - /// - /// RenewAtNumberOfDaysBeforeExpiry - /// - [Parameter(ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies how many days before expiry the automatic certificate renewal process begins.")] - public int? RenewAtNumberOfDaysBeforeExpiry { get; set; } - - /// - /// RenewAtPercentageLifetime - /// - [Parameter(ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the percentage of the lifetime after which the automatic process for the certificate renewal begins.")] - public int? RenewAtPercentageLifetime { get; set; } - /// /// EmailAtNumberOfDaysBeforeExpiry /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies how many days before expiry the automatic notification process begins.")] public int? EmailAtNumberOfDaysBeforeExpiry { get; set; } /// /// EmailAtPercentageLifetime /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the percentage of the lifetime after which the automatic process for the notification begins.")] public int? EmailAtPercentageLifetime { get; set; } /// /// Key type /// - [Parameter(ValueFromPipelineByPropertyName = true, + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the key type of the key backing the certificate.")] [ValidateSet(Constants.RSA, Constants.RSAHSM)] public string KeyType { get; set; } @@ -144,13 +202,14 @@ public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// /// KeyNotExportable /// - [Parameter(ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies whether the key is not exportable.")] + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies whether the key is not exportable.")] public SwitchParameter KeyNotExportable { get; set; } #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { if (ShouldProcess(string.Empty, Properties.Resources.CreateCertificatePolicy)) { @@ -159,12 +218,6 @@ protected override void ProcessRecord() ValidateDnsNames(); ValidateKeyUsage(); ValidateEkus(); - ValidateRenewAtNumberOfDaysBeforeExpiry(); - ValidateRenewAtPercentageLifetime(); - - // Validate combinations of parameters - ValidateBothPercentageAndNumberOfDaysAreNotPresent(); - ValidateAtLeastOneOfSubjectNameAndDnsNamesIsPresent(); var policy = new PSKeyVaultCertificatePolicy { @@ -190,51 +243,6 @@ protected override void ProcessRecord() } } - private void ValidateAtLeastOneOfSubjectNameAndDnsNamesIsPresent() - { - if (SubjectName == null && - DnsNames == null) - { - throw new ArgumentException("At least one of subject name or DNS names must be specified."); - } - } - - private void ValidateBothPercentageAndNumberOfDaysAreNotPresent() - { - if (RenewAtNumberOfDaysBeforeExpiry != null && - RenewAtPercentageLifetime != null) - { - throw new ArgumentException("Both RenewAtNumberOfDaysBeforeExpiry and RenewAtPercentageLifetime cannot be specified."); - } - } - - private void ValidateRenewAtPercentageLifetime() - { - if (RenewAtPercentageLifetime != null) - { - if (RenewAtPercentageLifetime < 0) - { - throw new ArgumentException("RenewAtPercentageLifetime must be larger than or equal to 0."); - } - - if (RenewAtPercentageLifetime >= 100) - { - throw new ArgumentException("RenewAtPercentageLifetime must be smaller than 100."); - } - } - } - - private void ValidateRenewAtNumberOfDaysBeforeExpiry() - { - if (RenewAtNumberOfDaysBeforeExpiry != null) - { - if (RenewAtNumberOfDaysBeforeExpiry <= 0) - { - throw new ArgumentException("RenewAtNumberOfDaysBeforeExpiry must be larger than 0."); - } - } - } - private void ValidateKeyUsage() { if (KeyUsage != null) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs index 64766ab8c35c..e100877091a4 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs @@ -96,7 +96,7 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the organization details to be used with the issuer.")] [ValidateNotNullOrEmpty] - public KeyVaultCertificateOrganizationDetails OrganizationDetails { get; set; } + public PSKeyVaultCertificateOrganizationDetails OrganizationDetails { get; set; } #endregion diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs index 9309da42dd24..5de99fca8984 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs @@ -120,7 +120,7 @@ public interface IKeyVaultDataServiceClient IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options); - IssuerBundle SetCertificateIssuer(string vaultName, string issuerName, string issuerProvider, string accountId, SecureString apiKey, KeyVaultCertificateOrganizationDetails organizationDetails); + IssuerBundle SetCertificateIssuer(string vaultName, string issuerName, string issuerProvider, string accountId, SecureString apiKey, PSKeyVaultCertificateOrganizationDetails organizationDetails); IssuerBundle DeleteCertificateIssuer(string vaultName, string issuerName); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs index dc328f24f651..59a728fe684a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs @@ -1036,7 +1036,7 @@ public IssuerBundle SetCertificateIssuer( string issuerProvider, string accountId, SecureString apiKey, - KeyVaultCertificateOrganizationDetails organizationDetails) + PSKeyVaultCertificateOrganizationDetails organizationDetails) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateAdministratorDetails.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateAdministratorDetails.cs similarity index 79% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateAdministratorDetails.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateAdministratorDetails.cs index ea7def389fc4..2a66563aeec9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateAdministratorDetails.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateAdministratorDetails.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class KeyVaultCertificateAdministratorDetails + public class PSKeyVaultCertificateAdministratorDetails { public string FirstName { get; set; } public string LastName { get; set; } @@ -37,14 +37,14 @@ internal AdministratorDetails ToAdministratorDetails() }; } - internal static KeyVaultCertificateAdministratorDetails FromAdministratorDetails(AdministratorDetails administratorDetails) + internal static PSKeyVaultCertificateAdministratorDetails FromAdministratorDetails(AdministratorDetails administratorDetails) { if (administratorDetails == null) { return null; } - return new KeyVaultCertificateAdministratorDetails + return new PSKeyVaultCertificateAdministratorDetails { FirstName = administratorDetails.FirstName, LastName = administratorDetails.LastName, @@ -53,17 +53,17 @@ internal static KeyVaultCertificateAdministratorDetails FromAdministratorDetails }; } - internal static List FromAdministratorDetails(IEnumerable administratorDetails) + internal static List FromAdministratorDetails(IEnumerable administratorDetails) { if (administratorDetails == null || administratorDetails.Count() == 0) { return null; } - return administratorDetails.Select(adminDetails => KeyVaultCertificateAdministratorDetails.FromAdministratorDetails(adminDetails)).ToList(); + return administratorDetails.Select(adminDetails => PSKeyVaultCertificateAdministratorDetails.FromAdministratorDetails(adminDetails)).ToList(); } - internal static List ToAdministratorDetails(IEnumerable administratorDetails) + internal static List ToAdministratorDetails(IEnumerable administratorDetails) { if (administratorDetails == null || administratorDetails.Count() == 0) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs index 0b3b2426c6cd..e94018c28a4f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs @@ -23,7 +23,7 @@ public class PSKeyVaultCertificateIssuer public string IssuerProvider { get; set; } public string AccountId { get; set; } public SecureString ApiKey { get; set; } - public KeyVaultCertificateOrganizationDetails OrganizationDetails { get; set; } + public PSKeyVaultCertificateOrganizationDetails OrganizationDetails { get; set; } internal static PSKeyVaultCertificateIssuer FromIssuer(IssuerBundle issuer) { @@ -36,7 +36,7 @@ internal static PSKeyVaultCertificateIssuer FromIssuer(IssuerBundle issuer) { Name = issuer.IssuerIdentifier.Name, IssuerProvider = issuer.Provider, - OrganizationDetails = KeyVaultCertificateOrganizationDetails.FromOrganizationalDetails(issuer.OrganizationDetails), + OrganizationDetails = PSKeyVaultCertificateOrganizationDetails.FromOrganizationalDetails(issuer.OrganizationDetails), }; if (issuer.Credentials != null) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateOrganizationDetails.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOrganizationDetails.cs similarity index 68% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateOrganizationDetails.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOrganizationDetails.cs index f7176cb1b4ea..a3c8842a14cb 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultCertificateOrganizationDetails.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOrganizationDetails.cs @@ -18,32 +18,32 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class KeyVaultCertificateOrganizationDetails + public class PSKeyVaultCertificateOrganizationDetails { public string Id { get; set; } - public List AdministratorDetails { get; set; } + public List AdministratorDetails { get; set; } internal OrganizationDetails ToOrganizationDetails() { return new OrganizationDetails { Id = Id, - AdminDetails = KeyVaultCertificateAdministratorDetails.ToAdministratorDetails(AdministratorDetails), + AdminDetails = PSKeyVaultCertificateAdministratorDetails.ToAdministratorDetails(AdministratorDetails), }; } - internal static KeyVaultCertificateOrganizationDetails FromOrganizationalDetails(OrganizationDetails organizationalDetails) + internal static PSKeyVaultCertificateOrganizationDetails FromOrganizationalDetails(OrganizationDetails organizationalDetails) { if (organizationalDetails == null) { return null; } - var kvcOrganizationDetails = new KeyVaultCertificateOrganizationDetails + var kvcOrganizationDetails = new PSKeyVaultCertificateOrganizationDetails { Id = organizationalDetails.Id, - AdministratorDetails = KeyVaultCertificateAdministratorDetails.FromAdministratorDetails(organizationalDetails.AdminDetails), + AdministratorDetails = PSKeyVaultCertificateAdministratorDetails.FromAdministratorDetails(organizationalDetails.AdminDetails), }; return kvcOrganizationDetails; From c25f805b8b9b5ffb7a04e4a067799454a58ca4cb Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Tue, 27 Feb 2018 18:08:53 -0800 Subject: [PATCH 04/19] more changes --- .../GetAzureKeyVaultCertificateContact.cs | 2 +- .../Commands/RemoveAzureKeyVault.cs | 123 ++++++++++----- .../RemoveAzureKeyVaultAccessPolicy.cs | 149 ++++++++++++++++-- .../RemoveAzureKeyVaultCertificate.cs | 51 ++++-- .../RemoveAzureKeyVaultCertificateContact.cs | 88 +++++------ .../RemoveAzureKeyVaultCertificateIssuer.cs | 20 ++- ...RemoveAzureKeyVaultCertificateOperation.cs | 2 +- .../Commands/RemoveAzureKeyVaultKey.cs | 39 ++++- .../Commands/RemoveAzureKeyVaultSecret.cs | 37 ++++- .../Commands/RestoreAzureKeyVaultKey.cs | 42 ++++- .../Commands/RestoreAzureKeyVaultSecret.cs | 50 ++++-- 11 files changed, 456 insertions(+), 147 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs index 779b8ec8fe39..d80e29d48d88 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs @@ -115,7 +115,7 @@ public override void ExecuteCmdlet() contactsModel.Add(PSKeyVaultCertificateContact.FromKVCertificateContact(contact)); } - this.WriteObject(contactsModel); + this.WriteObject(contactsModel, true); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs index 76b815957610..67846102b6c8 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs @@ -12,16 +12,18 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.KeyVault.Models; +using Microsoft.Azure.Commands.KeyVault.Properties; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using System; using System.Globalization; using System.Management.Automation; -using PSKeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Remove, "AzureRmKeyVault", SupportsShouldProcess = true, + DefaultParameterSetName = RemoveVaultParameterSet, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase @@ -31,6 +33,9 @@ public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase private const string RemoveVaultParameterSet = "ByAvailableVault"; private const string RemoveDeletedVaultParameterSet = "ByDeletedVault"; + private const string InputObjectRemoveVaultParameterSet = "InputObjectByAvailableVault"; + private const string InputObjectRemoveDeletedVaultParameterSet = "InputObjectByDeletedVault"; + #endregion #region Input Parameter Definitions @@ -40,11 +45,33 @@ public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = RemoveVaultParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the key vault to remove.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = RemoveDeletedVaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the name of the key vault to remove.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } + /// + /// Vault object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectRemoveVaultParameterSet, + ValueFromPipeline = true, + HelpMessage = "Key Vault object to be deleted.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectRemoveDeletedVaultParameterSet, + ValueFromPipeline = true, + HelpMessage = "Key Vault object to be deleted.")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + /// /// Resource group to which the vault belongs. /// @@ -62,30 +89,43 @@ public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase ParameterSetName = RemoveVaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "The location of the deleted vault.")] + [Parameter(Mandatory = false, + Position = 1, + ParameterSetName = InputObjectRemoveVaultParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The location of the deleted vault.")] [Parameter(Mandatory = true, - Position = 2, + Position = 1, ParameterSetName = RemoveDeletedVaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "The location of the deleted vault.")] + [Parameter(Mandatory = true, + Position = 1, + ParameterSetName = InputObjectRemoveDeletedVaultParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "The location of the deleted vault.")] [LocationCompleter("Microsoft.KeyVault/vaults")] [ValidateNotNullOrEmpty()] public string Location { get; set; } - /// - /// If present, do not ask for confirmation - /// - [Parameter(Mandatory = false, - HelpMessage = "Indicates that the cmdlet does not prompt you for confirmation. By default, this cmdlet prompts you to confirm that you want to delete the key vault.")] - public SwitchParameter Force { get; set; } - /// /// If present, operate on the deleted vault entity. /// - [Parameter(Mandatory = false, + [Parameter(Mandatory = true, ParameterSetName = RemoveDeletedVaultParameterSet, HelpMessage = "Remove the previously deleted vault permanently.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectRemoveDeletedVaultParameterSet, + HelpMessage = "Remove the previously deleted vault permanently.")] public SwitchParameter InRemovedState { get; set; } + /// + /// If present, do not ask for confirmation + /// + [Parameter(Mandatory = false, + HelpMessage = "Indicates that the cmdlet does not prompt you for confirmation. By default, this cmdlet prompts you to confirm that you want to delete the key vault.")] + public SwitchParameter Force { get; set; } + [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] public SwitchParameter AsJob { get; set; } @@ -93,40 +133,23 @@ public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase public override void ExecuteCmdlet() { - switch (ParameterSetName) + if (InputObject != null) { - case RemoveVaultParameterSet: - ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName; - if (string.IsNullOrWhiteSpace(ResourceGroupName)) - throw new ArgumentException(string.Format(PSKeyVaultProperties.Resources.VaultNotFound, VaultName, ResourceGroupName)); - ConfirmAction( - Force.IsPresent, - string.Format( - CultureInfo.InvariantCulture, - PSKeyVaultProperties.Resources.RemoveVaultWarning, - VaultName), - string.Format( - CultureInfo.InvariantCulture, - PSKeyVaultProperties.Resources.RemoveVaultWhatIfMessage, - VaultName), - VaultName, - () => - { - KeyVaultManagementClient.DeleteVault( - vaultName: VaultName, - resourceGroupName: this.ResourceGroupName); - }); - break; - case RemoveDeletedVaultParameterSet: - ConfirmAction( + VaultName = InputObject.VaultName; + ResourceGroupName = InputObject.ResourceGroupName; + } + + if (InRemovedState) + { + ConfirmAction( Force.IsPresent, string.Format( CultureInfo.InvariantCulture, - PSKeyVaultProperties.Resources.PurgeVaultWarning, + Resources.PurgeVaultWarning, VaultName), string.Format( CultureInfo.InvariantCulture, - PSKeyVaultProperties.Resources.PurgeVaultWhatIfMessage, + Resources.PurgeVaultWhatIfMessage, VaultName), VaultName, () => @@ -135,9 +158,29 @@ public override void ExecuteCmdlet() vaultName: VaultName, location: Location); }); - break; - default: - throw new ArgumentException(PSKeyVaultProperties.Resources.BadParameterSetName); + } + else + { + ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName; + if (string.IsNullOrWhiteSpace(ResourceGroupName)) + throw new ArgumentException(string.Format(Resources.VaultNotFound, VaultName, ResourceGroupName)); + ConfirmAction( + Force.IsPresent, + string.Format( + CultureInfo.InvariantCulture, + Resources.RemoveVaultWarning, + VaultName), + string.Format( + CultureInfo.InvariantCulture, + Resources.RemoveVaultWhatIfMessage, + VaultName), + VaultName, + () => + { + KeyVaultManagementClient.DeleteVault( + vaultName: VaultName, + resourceGroupName: this.ResourceGroupName); + }); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs index 824c1dde3174..e95d5221df78 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs @@ -12,19 +12,20 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.KeyVault.Models; +using Microsoft.Azure.Commands.KeyVault.Properties; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using System; using System.Linq; using System.Management.Automation; -using PSKeyVaultModels = Microsoft.Azure.Commands.KeyVault.Models; -using PSKeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Remove, "AzureRmKeyVaultAccessPolicy", SupportsShouldProcess = true, + DefaultParameterSetName = ByUserPrincipalName, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSKeyVaultModels.PSVault))] + [OutputType(typeof(PSVault))] public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase { #region Parameter Set Names @@ -35,6 +36,12 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase private const string ByEmail = "ByEmail"; private const string ForVault = "ForVault"; + private const string InputObjectByObjectId = "InputObjectByObjectId"; + private const string InputObjectByServicePrincipalName = "InputObjectByServicePrincipalName"; + private const string InputObjectByUserPrincipalName = "InputObjectByUserPrincipalName"; + private const string InputObjectByEmail = "InputObjectByEmail"; + private const string InputObjectForVault = "InputObjectForVault"; + #endregion #region Input Parameter Definitions @@ -44,6 +51,27 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = ByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the key vault. This cmdlet removes permissions for the key vault that this parameter specifies.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ByServicePrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the key vault. This cmdlet removes permissions for the key vault that this parameter specifies.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ByUserPrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the key vault. This cmdlet removes permissions for the key vault that this parameter specifies.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ByEmail, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the key vault. This cmdlet removes permissions for the key vault that this parameter specifies.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the name of the key vault. This cmdlet removes permissions for the key vault that this parameter specifies.")] [ValidateNotNullOrEmpty] @@ -54,12 +82,64 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase /// [Parameter(Mandatory = false, Position = 1, + ParameterSetName = ByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the resource group associated with the key vault whose permissions you want to remove.")] + [Parameter(Mandatory = false, + Position = 1, + ParameterSetName = ByServicePrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the resource group associated with the key vault whose permissions you want to remove.")] + [Parameter(Mandatory = false, + Position = 1, + ParameterSetName = ByUserPrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the resource group associated with the key vault whose permissions you want to remove.")] + [Parameter(Mandatory = false, + Position = 1, + ParameterSetName = ByEmail, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the name of the resource group associated with the key vault whose permissions you want to remove.")] + [Parameter(Mandatory = false, + Position = 1, + ParameterSetName = ForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the name of the resource group associated with the key vault whose permissions you want to remove.")] [ResourceGroupCompleter] [ValidateNotNullOrEmpty()] public string ResourceGroupName { get; set; } + /// + /// Vault object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectByObjectId, + ValueFromPipeline = true, + HelpMessage = "Key Vault object.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectByServicePrincipalName, + ValueFromPipeline = true, + HelpMessage = "Key Vault object.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectByUserPrincipalName, + ValueFromPipeline = true, + HelpMessage = "Key Vault object.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectByEmail, + ValueFromPipeline = true, + HelpMessage = "Key Vault object.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectForVault, + ValueFromPipeline = true, + HelpMessage = "Key Vault object.")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + /// /// Service principal name /// @@ -67,6 +147,10 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByServicePrincipalName, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the service principal name of the application whose permissions you want to remove. Specify the application ID, also known as client ID, registered for the application in Azure Active Directory.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByServicePrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the service principal name of the application whose permissions you want to remove. Specify the application ID, also known as client ID, registered for the application in Azure Active Directory.")] [ValidateNotNullOrEmpty()] [Alias("SPN")] public string ServicePrincipalName { get; set; } @@ -78,6 +162,10 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByUserPrincipalName, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the user principal name of the user whose access you want to remove.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByUserPrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the user principal name of the user whose access you want to remove.")] [ValidateNotNullOrEmpty()] [Alias("UPN")] public string UserPrincipalName { get; set; } @@ -89,6 +177,10 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByObjectId, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the object ID of the user or service principal in Azure Active Directory for which to remove permissions.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the object ID of the user or service principal in Azure Active Directory for which to remove permissions.")] [ValidateNotNullOrEmpty()] public string ObjectId { get; set; } @@ -99,6 +191,10 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByEmail, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the email address of the user in Azure Active Directory for which to grant permissions.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByEmail, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the email address of the user in Azure Active Directory for which to grant permissions.")] [ValidateNotNullOrEmpty()] public string EmailAddress { get; set; } @@ -109,25 +205,44 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByObjectId, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the ID of application that a user must.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the ID of application that a user must.")] public Guid? ApplicationId { get; set; } [Parameter(Mandatory = false, ParameterSetName = ForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "If specified, disables the retrieval of secrets from this key vault by the Microsoft.Compute resource provider when referenced in resource creation.")] - public SwitchParameter EnabledForDeployment { get; set; } + [Parameter(Mandatory = false, + ParameterSetName = InputObjectForVault, + ValueFromPipelineByPropertyName = true, + HelpMessage = "If specified, disables the retrieval of secrets from this key vault by the Microsoft.Compute resource provider when referenced in resource creation.")] + [Alias("EnabledForDeployment")] + public SwitchParameter DisableDeployment { get; set; } [Parameter(Mandatory = false, ParameterSetName = ForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "If specified, disables the retrieval of secrets from this key vault by Azure Resource Manager when referenced in templates.")] - public SwitchParameter EnabledForTemplateDeployment { get; set; } + [Parameter(Mandatory = false, + ParameterSetName = InputObjectForVault, + ValueFromPipelineByPropertyName = true, + HelpMessage = "If specified, disables the retrieval of secrets from this key vault by Azure Resource Manager when referenced in templates.")] + [Alias("EnabledForTemplateDeployment")] + public SwitchParameter DisableTemplateDeployment { get; set; } [Parameter(Mandatory = false, ParameterSetName = ForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "If specified, disables the retrieval of secrets from this key vault by Azure Disk Encryption.")] - public SwitchParameter EnabledForDiskEncryption { get; set; } + [Parameter(Mandatory = false, + ParameterSetName = InputObjectForVault, + ValueFromPipelineByPropertyName = true, + HelpMessage = "If specified, disables the retrieval of secrets from this key vault by Azure Disk Encryption.")] + [Alias("EnabledForDiskEncryption")] + public SwitchParameter DisableDiskEncryption { get; set; } /// /// @@ -143,16 +258,16 @@ public override void ExecuteCmdlet() { if (ShouldProcess(VaultName, Properties.Resources.RemoveVaultAccessPolicy)) { - if (ParameterSetName == ForVault && !EnabledForDeployment.IsPresent && - !EnabledForTemplateDeployment.IsPresent && !EnabledForDiskEncryption.IsPresent) + if (InputObject != null) { - throw new ArgumentException(PSKeyVaultProperties.Resources.VaultPermissionFlagMissing); + VaultName = InputObject.VaultName; + ResourceGroupName = InputObject.ResourceGroupName; } ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName; // Get the vault to be updated - PSKeyVaultModels.PSVault existingVault = null; + PSVault existingVault = null; if (!string.IsNullOrWhiteSpace(ResourceGroupName)) existingVault = KeyVaultManagementClient.GetVault( @@ -160,15 +275,15 @@ public override void ExecuteCmdlet() ResourceGroupName); if (existingVault == null) { - throw new ArgumentException(string.Format(PSKeyVaultProperties.Resources.VaultNotFound, VaultName, ResourceGroupName)); + throw new ArgumentException(string.Format(Resources.VaultNotFound, VaultName, ResourceGroupName)); } if (ApplicationId.HasValue && ApplicationId.Value == Guid.Empty) - throw new ArgumentException(PSKeyVaultProperties.Resources.InvalidApplicationId); + throw new ArgumentException(Resources.InvalidApplicationId); if (!string.IsNullOrWhiteSpace(this.ObjectId) && !this.IsValidObjectIdSyntax(this.ObjectId)) { - throw new ArgumentException(PSKeyVaultProperties.Resources.InvalidObjectIdSyntax); + throw new ArgumentException(Resources.InvalidObjectIdSyntax); } // Update vault policies @@ -187,16 +302,16 @@ public override void ExecuteCmdlet() // Update the vault var updatedVault = KeyVaultManagementClient.UpdateVault(existingVault, updatedPolicies, - EnabledForDeployment.IsPresent ? false : existingVault.EnabledForDeployment, - EnabledForTemplateDeployment.IsPresent ? false : existingVault.EnabledForTemplateDeployment, - EnabledForDiskEncryption.IsPresent ? false : existingVault.EnabledForDiskEncryption, + DisableDeployment.IsPresent ? false : existingVault.EnabledForDeployment, + DisableTemplateDeployment.IsPresent ? false : existingVault.EnabledForTemplateDeployment, + DisableDiskEncryption.IsPresent ? false : existingVault.EnabledForDiskEncryption, ActiveDirectoryClient); if (PassThru.IsPresent) WriteObject(updatedVault); } } - private bool ShallBeRemoved(PSKeyVaultModels.PSVaultAccessPolicy ap, string objectId, Guid? applicationId) + private bool ShallBeRemoved(PSVaultAccessPolicy ap, string objectId, Guid? applicationId) { // If both object id and application id are specified, remove the compound identity policy only. // If only object id is specified, remove all policies refer to the object id including the compound identity policies. diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs index 622d36b0ee71..e3c0b9921aff 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs @@ -15,7 +15,7 @@ using System.Globalization; using System.Management.Automation; using Microsoft.Azure.Commands.KeyVault.Models; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { @@ -24,11 +24,19 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsCommon.Remove, CmdletNoun.AzureKeyVaultCertificate, SupportsShouldProcess = true, + DefaultParameterSetName = ByVaultNameAndNameParameterSet, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSDeletedKeyVaultCertificate))] public class RemoveAzureKeyVaultCertificate : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string ByVaultNameAndNameParameterSet = "ByVaultNameAndName"; + private const string ByObjectParameterSet = "ByObject"; + + #endregion + #region Input Parameter Definitions /// @@ -36,6 +44,7 @@ public class RemoveAzureKeyVaultCertificate : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = ByVaultNameAndNameParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the name of the vault to which this cmdlet adds the certificate.")] [ValidateNotNullOrEmpty] @@ -46,44 +55,62 @@ public class RemoveAzureKeyVaultCertificate : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = ByVaultNameAndNameParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the name of the certificate in key vault.")] [ValidateNotNullOrEmpty] public string Name { get; set; } /// - /// If present, do not ask for confirmation + /// Vault Object /// - [Parameter( Mandatory = false, - HelpMessage = "Do not ask for confirmation.")] - public SwitchParameter Force { get; set; } + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ByObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Certificate Object.")] + [ValidateNotNullOrEmpty] + public PSKeyVaultCertificate InputObject { get; set; } /// /// If present, operate on the deleted key entity. /// - [Parameter( Mandatory = false, - HelpMessage = "Permanently remove the previously deleted certificate." )] + [Parameter(Mandatory = false, + HelpMessage = "Permanently remove the previously deleted certificate.")] public SwitchParameter InRemovedState { get; set; } + /// + /// If present, do not ask for confirmation + /// + [Parameter( Mandatory = false, + HelpMessage = "Do not ask for confirmation.")] + public SwitchParameter Force { get; set; } + [Parameter( Mandatory = false, HelpMessage = "Cmdlet does not return an object by default. If this switch is specified, the cmdlet returns the certificate object that was deleted.")] public SwitchParameter PassThru { get; set; } #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + if ( InRemovedState.IsPresent ) { ConfirmAction( Force.IsPresent, string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveDeletedCertificateWarning, + Resources.RemoveDeletedCertificateWarning, Name ), string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveDeletedCertificateWhatIfMessage, + Resources.RemoveDeletedCertificateWhatIfMessage, Name ), Name, ( ) => { DataServiceClient.PurgeCertificate( VaultName, Name ); } ); @@ -97,11 +124,11 @@ protected override void ProcessRecord() Force.IsPresent, string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveCertWarning, + Resources.RemoveCertWarning, Name), string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveCertWhatIfMessage, + Resources.RemoveCertWhatIfMessage, Name), Name, () => { certBundle = PSDeletedKeyVaultCertificate.FromDeletedCertificateBundle( this.DataServiceClient.DeleteCertificate(VaultName, Name) ); }); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs index 20aa7504431e..1c0d53d7ec45 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs @@ -26,22 +26,14 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsCommon.Remove, CmdletNoun.AzureKeyVaultCertificateContact, SupportsShouldProcess = true, - DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(List))] public class RemoveAzureKeyVaultCertificateContact : KeyVaultCmdletBase { - #region Parameter Set Names - - private const string ByVaultNameParameterSet = "VaultName"; - - #endregion - /// /// VaultName /// [Parameter(Mandatory = true, - ParameterSetName = ByVaultNameParameterSet, Position = 0, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] @@ -56,63 +48,67 @@ public class RemoveAzureKeyVaultCertificateContact : KeyVaultCmdletBase ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the email address of the contact.")] [ValidateNotNullOrEmpty] - public string EmailAddress { get; set; } + public string[] EmailAddress { get; set; } /// /// PassThru parameter /// - [Parameter(HelpMessage = "This cmdlet does not return an object by default. If this switch is specified, it returns the contact object.")] + [Parameter(Mandatory = false, + HelpMessage = "This cmdlet does not return an object by default. If this switch is specified, it returns the contact object.")] public SwitchParameter PassThru { get; set; } - protected override void ProcessRecord() + public override void ExecuteCmdlet() { - if (ShouldProcess(EmailAddress, Properties.Resources.RemoveCertificateContact)) + foreach (string email in EmailAddress) { - Contacts existingContacts; - - try + if (ShouldProcess(email, Properties.Resources.RemoveCertificateContact)) { - existingContacts = this.DataServiceClient.GetCertificateContacts(VaultName); - } - catch (KeyVaultErrorException exception) - { - if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound) + Contacts existingContacts; + + try { - throw; + existingContacts = this.DataServiceClient.GetCertificateContacts(VaultName); } + catch (KeyVaultErrorException exception) + { + if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound) + { + throw; + } - existingContacts = null; - } + existingContacts = null; + } - List existingContactList; + List existingContactList; - if (existingContacts == null || - existingContacts.ContactList == null) - { - existingContactList = new List(); - } - else - { - existingContactList = new List(existingContacts.ContactList); - } + if (existingContacts == null || + existingContacts.ContactList == null) + { + existingContactList = new List(); + } + else + { + existingContactList = new List(existingContacts.ContactList); + } - var nContactsRemoved = existingContactList.RemoveAll(contact => string.Compare(contact.EmailAddress, EmailAddress, StringComparison.OrdinalIgnoreCase) == 0); + var nContactsRemoved = existingContactList.RemoveAll(contact => string.Compare(contact.EmailAddress, email, StringComparison.OrdinalIgnoreCase) == 0); - if (nContactsRemoved == 0) - { - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Provided email address '{0}' is not found.", EmailAddress)); - } + if (nContactsRemoved == 0) + { + throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Provided email address '{0}' is not found.", EmailAddress)); + } - if (existingContactList.Count == 0) - { - existingContactList = null; - } + if (existingContactList.Count == 0) + { + existingContactList = null; + } - var resultantContacts = this.DataServiceClient.SetCertificateContacts(VaultName, new Contacts { ContactList = existingContactList }); + var resultantContacts = this.DataServiceClient.SetCertificateContacts(VaultName, new Contacts { ContactList = existingContactList }); - if (PassThru.IsPresent) - { - this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts)); + if (PassThru.IsPresent) + { + this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts)); + } } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs index 4cabdbc3debd..771487835416 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs @@ -29,6 +29,7 @@ public class RemoveAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase #region Parameter Set Names private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; #endregion @@ -49,12 +50,24 @@ public class RemoveAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name.")] [ValidateNotNullOrEmpty] [Alias(Constants.IssuerName)] public string Name { get; set; } + /// + /// Certificate Issuer Object + /// + [Parameter(Mandatory = true, + Position = 1, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Certificate Issuer Object")] + [ValidateNotNullOrEmpty] + public PSKeyVaultCertificateIssuer InputObject { get; set; } + /// /// If present, do not ask for confirmation /// @@ -70,8 +83,13 @@ public class RemoveAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase public SwitchParameter PassThru { get; set; } #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { + if (InputObject != null) + { + Name = InputObject.Name; + } + PSKeyVaultCertificateIssuer issuer = null; ConfirmAction( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs index f83bd76273e4..69943129a83d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs @@ -66,7 +66,7 @@ public class RemoveAzureKeyVaultCertificateOperation : KeyVaultCmdletBase #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { CertificateOperation certificateOperation = null; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs index a9d4fb5fcb68..83f9d0b2aef9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs @@ -15,17 +15,25 @@ using Microsoft.Azure.Commands.KeyVault.Models; using System.Globalization; using System.Management.Automation; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Remove, "AzureKeyVaultKey", SupportsShouldProcess = true, + DefaultParameterSetName = ByVaultNameParameterSet, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSDeletedKeyBundle))] public class RemoveAzureKeyVaultKey : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string ByVaultNameParameterSet = "ByVaultName"; + private const string ByInputObjectParameterSet = "ByInputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -34,6 +42,7 @@ public class RemoveAzureKeyVaultKey : KeyVaultCmdletBase [Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, + ParameterSetName = ByVaultNameParameterSet, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } @@ -44,11 +53,23 @@ public class RemoveAzureKeyVaultKey : KeyVaultCmdletBase [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, + ParameterSetName = ByVaultNameParameterSet, HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] [ValidateNotNullOrEmpty] [Alias(Constants.KeyName)] public string Name { get; set; } + /// + /// KeyBundle object + /// + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = ByInputObjectParameterSet, + HelpMessage = "KeyBundle Object")] + [ValidateNotNullOrEmpty] + public PSKeyBundle InputObject { get; set; } + /// /// If present, do not ask for confirmation /// @@ -70,17 +91,23 @@ public class RemoveAzureKeyVaultKey : KeyVaultCmdletBase #endregion public override void ExecuteCmdlet() { - if(InRemovedState.IsPresent) + if (InputObject != null) + { + VaultName = InputObject.VaultName.ToString(); + Name = InputObject.Name.ToString(); + } + + if (InRemovedState.IsPresent) { ConfirmAction( Force.IsPresent, string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveDeletedKeyWarning, + Resources.RemoveDeletedKeyWarning, Name), string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveDeletedKeyWhatIfMessage, + Resources.RemoveDeletedKeyWhatIfMessage, Name), Name, () => { DataServiceClient.PurgeKey(VaultName, Name); }); @@ -92,11 +119,11 @@ public override void ExecuteCmdlet() Force.IsPresent, string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveKeyWarning, + Resources.RemoveKeyWarning, Name), string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveKeyWhatIfMessage, + Resources.RemoveKeyWhatIfMessage, Name), Name, () => { deletedKeyBundle = DataServiceClient.DeleteKey(VaultName, Name); }); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs index a36b170de9f3..534c99ddf97f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs @@ -13,19 +13,27 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.KeyVault.Models; +using Microsoft.Azure.Commands.KeyVault.Properties; using System.Globalization; using System.Management.Automation; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Remove, "AzureKeyVaultSecret", SupportsShouldProcess = true, + DefaultParameterSetName = ByVaultNameParameterSet, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSDeletedSecret))] public class RemoveAzureKeyVaultSecret : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string ByVaultNameParameterSet = "ByVaultName"; + private const string ByInputObjectParameterSet = "ByInputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -33,6 +41,7 @@ public class RemoveAzureKeyVaultSecret : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = ByVaultNameParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -43,12 +52,24 @@ public class RemoveAzureKeyVaultSecret : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = ByVaultNameParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] [ValidateNotNullOrEmpty] [Alias(Constants.SecretName)] public string Name { get; set; } + /// + /// Secret Object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ByInputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Key Vault Secret Object")] + [ValidateNotNullOrEmpty] + public PSSecret InputObject { get; set; } + /// /// If present, do not ask for confirmation /// @@ -71,17 +92,23 @@ public class RemoveAzureKeyVaultSecret : KeyVaultCmdletBase public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + if(InRemovedState.IsPresent) { ConfirmAction( Force.IsPresent, string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveDeletedSecretWarning, + Resources.RemoveDeletedSecretWarning, Name), string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveDeletedSecretWhatIfMessage, + Resources.RemoveDeletedSecretWhatIfMessage, Name), Name, () => { DataServiceClient.PurgeSecret(VaultName, Name); }); @@ -93,11 +120,11 @@ public override void ExecuteCmdlet() Force.IsPresent, string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveSecretWarning, + Resources.RemoveSecretWarning, Name), string.Format( CultureInfo.InvariantCulture, - KeyVaultProperties.Resources.RemoveSecretWhatIfMessage, + Resources.RemoveSecretWhatIfMessage, Name), Name, () => { deletedSecret = DataServiceClient.DeleteSecret(VaultName, Name); }); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs index 068816aae795..eeffc40d8904 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs @@ -13,9 +13,9 @@ // ---------------------------------------------------------------------------------- using Microsoft.Azure.Commands.KeyVault.Models; +using Microsoft.Azure.Commands.KeyVault.Properties; using System.IO; using System.Management.Automation; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { @@ -24,10 +24,18 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsData.Restore, "AzureKeyVaultKey", SupportsShouldProcess = true, + DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSKeyBundle))] public class RestoreAzureKeyVaultKey : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string ByVaultNameParameterSet = "ByVaultName"; + private const string ByInputObjectParameterSet = "ByInputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -35,11 +43,23 @@ public class RestoreAzureKeyVaultKey : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = ByVaultNameParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } + /// + /// KeyVault object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ByInputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "KeyVault object")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + /// /// The input file in which the backup blob is stored /// @@ -47,19 +67,27 @@ public class RestoreAzureKeyVaultKey : KeyVaultCmdletBase Position = 1, HelpMessage = "Input file. The input file containing the backed-up blob")] [ValidateNotNullOrEmpty] - public string InputFile { get; set; } + public string[] InputFile { get; set; } #endregion Input Parameter Definitions public override void ExecuteCmdlet() { - if (ShouldProcess(VaultName, Properties.Resources.RestoreKey)) + if (InputObject != null) + { + VaultName = InputObject.VaultName; + } + + foreach (var file in InputFile) { - var filePath = ResolvePath(InputFile); + if (ShouldProcess(VaultName, Properties.Resources.RestoreKey)) + { + var filePath = ResolvePath(file); - var restoredKeyBundle = this.DataServiceClient.RestoreKey(VaultName, filePath); + var restoredKeyBundle = this.DataServiceClient.RestoreKey(VaultName, filePath); - this.WriteObject(restoredKeyBundle); + this.WriteObject(restoredKeyBundle); + } } } @@ -68,7 +96,7 @@ private string ResolvePath(string filePath) FileInfo keyFile = new FileInfo(this.GetUnresolvedProviderPathFromPSPath(filePath)); if (!keyFile.Exists) { - throw new FileNotFoundException(string.Format(KeyVaultProperties.Resources.BackupKeyFileNotFound, filePath)); + throw new FileNotFoundException(string.Format(Resources.BackupKeyFileNotFound, filePath)); } return keyFile.FullName; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs index 24e66a4f7a61..3e2ae9d66757 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs @@ -16,7 +16,7 @@ using System.Management.Automation; using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.KeyVault.Models; -using KeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { @@ -25,22 +25,42 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet( VerbsData.Restore, "AzureKeyVaultSecret", SupportsShouldProcess = true, + DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri )] [OutputType( typeof(PSSecret) )] public class RestoreAzureKeyVaultSecret : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string ByVaultNameParameterSet = "ByVaultName"; + private const string ByInputObjectParameterSet = "ByInputObject"; + + #endregion + #region Input Parameter Definitions /// /// Vault name /// - [Parameter( Mandatory = true, + [Parameter(Mandatory = true, Position = 0, + ParameterSetName = ByInputObjectParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment." )] [ValidateNotNullOrEmpty] public string VaultName { get; set; } + /// + /// KeyVault object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ByInputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "KeyVault object")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + /// /// The input file in which the backup blob is stored /// @@ -48,24 +68,32 @@ public class RestoreAzureKeyVaultSecret : KeyVaultCmdletBase Position = 1, HelpMessage = "Input file. The input file containing the backed-up blob" )] [ValidateNotNullOrEmpty] - public string InputFile { get; set; } + public string[] InputFile { get; set; } #endregion Input Parameter Definitions public override void ExecuteCmdlet( ) { - if ( ShouldProcess( VaultName, Properties.Resources.RestoreSecret ) ) + if (InputObject != null) { - var resolvedFilePath = this.GetUnresolvedProviderPathFromPSPath( InputFile ); + VaultName = InputObject.VaultName; + } - if ( !AzureSession.Instance.DataStore.FileExists( resolvedFilePath ) ) - { - throw new FileNotFoundException( string.Format( KeyVaultProperties.Resources.BackupSecretFileNotFound, resolvedFilePath ) ); - } + foreach (var file in InputFile) + { + if (ShouldProcess(VaultName, Properties.Resources.RestoreSecret)) + { + var resolvedFilePath = this.GetUnresolvedProviderPathFromPSPath(file); + + if (!AzureSession.Instance.DataStore.FileExists(resolvedFilePath)) + { + throw new FileNotFoundException(string.Format(Resources.BackupSecretFileNotFound, resolvedFilePath)); + } - var restoredSecret = this.DataServiceClient.RestoreSecret(VaultName, resolvedFilePath); + var restoredSecret = this.DataServiceClient.RestoreSecret(VaultName, resolvedFilePath); - this.WriteObject( restoredSecret ); + this.WriteObject(restoredSecret); + } } } } From 7afcb04dc5f09ec0613d118c9f96da4620098283 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Wed, 28 Feb 2018 17:33:08 -0800 Subject: [PATCH 05/19] more changes --- .../UnitTests/RemoveKeyVaultKeyTests.cs | 4 +- .../UnitTests/SetKeyVaultKeyAttributeTests.cs | 8 +- .../SetKeyVaultSecretAttributeTests.cs | 8 +- .../UnitTests/SetKeyVaultSecretTests.cs | 8 +- .../Commands.KeyVault.csproj | 6 +- .../AddAzureKeyVaultCertificateContact.cs | 2 +- .../Commands/AddAzureKeyVaultKey.cs | 4 +- .../GetAzureKeyVaultCertificateContact.cs | 2 +- .../GetAzureKeyVaultCertificateIssuer.cs | 12 +- .../GetAzureKeyVaultCertificateOperation.cs | 2 + .../RemoveAzureKeyVaultCertificateContact.cs | 2 +- .../RemoveAzureKeyVaultCertificateIssuer.cs | 4 +- ...RemoveAzureKeyVaultCertificateOperation.cs | 26 +++ .../Commands/SetAzureKeyVaultAccessPolicy.cs | 211 ++++++++++++++++-- .../SetAzureKeyVaultCertificateAttribute.cs | 33 +++ .../SetAzureKeyVaultCertificateIssuer.cs | 85 +++++-- .../SetAzureKeyVaultCertificatePolicy.cs | 174 +++++++-------- .../Commands/SetAzureKeyVaultKeyAttribute.cs | 29 ++- .../Commands/SetAzureKeyVaultSecret.cs | 29 ++- .../SetAzureKeyVaultSecretAttribute.cs | 28 ++- .../StopAzureKeyVaultCertificateOperation.cs | 29 ++- .../UndoAzureKeyVaultCertificateRemoval.cs | 33 ++- .../Commands/UndoAzureKeyVaultKeyRemoval.cs | 31 ++- .../Models/IKeyVaultDataServiceClient.cs | 10 +- .../Models/KeyVaultDataServiceClient.cs | 10 +- .../Models/PSCertificateIssuerIdentityItem.cs | 2 + .../{KeyAttributes.cs => PSKeyAttributes.cs} | 10 +- .../Models/{KeyBundle.cs => PSKeyBundle.cs} | 4 +- .../Models/PSKeyVaultCertificateContact.cs | 9 +- .../Models/PSKeyVaultCertificateIssuer.cs | 2 + .../Models/PSKeyVaultCertificateOperation.cs | 3 + .../Commands.KeyVault/Models/PSSecret.cs | 4 +- ...retAttributes.cs => PSSecretAttributes.cs} | 10 +- 33 files changed, 649 insertions(+), 185 deletions(-) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyAttributes.cs => PSKeyAttributes.cs} (91%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{KeyBundle.cs => PSKeyBundle.cs} (95%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{SecretAttributes.cs => PSSecretAttributes.cs} (90%) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs index 309fff18f8dd..5f963458da54 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests public class RemoveKeyVaultKeyTests : KeyVaultUnitTestBase { private RemoveAzureKeyVaultKey cmdlet; - private KeyAttributes keyAttributes; + private PSKeyAttributes keyAttributes; private WebKey.JsonWebKey webKey; private PSDeletedKeyBundle keyBundle; @@ -39,7 +39,7 @@ public RemoveKeyVaultKeyTests() VaultName = VaultName }; - keyAttributes = new KeyAttributes(true, DateTime.Now, DateTime.Now, "HSM", new string[] { "All" }, null); + keyAttributes = new PSKeyAttributes(true, DateTime.Now, DateTime.Now, "HSM", new string[] { "All" }, null); webKey = new WebKey.JsonWebKey(); keyBundle = new PSDeletedKeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName }; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs index 7bf2c9009d53..ad6395b7d185 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests public class SetKeyVaultKeyAttributeTests : KeyVaultUnitTestBase { private SetAzureKeyVaultKeyAttribute cmdlet; - private KeyAttributes keyAttributes; + private PSKeyAttributes keyAttributes; private WebKey.JsonWebKey webKey; private PSKeyBundle keyBundle; @@ -32,7 +32,7 @@ public SetKeyVaultKeyAttributeTests() { base.SetupTest(); - keyAttributes = new KeyAttributes(true, DateTime.Now, DateTime.Now, null, null, null); + keyAttributes = new PSKeyAttributes(true, DateTime.Now, DateTime.Now, null, null, null); webKey = new WebKey.JsonWebKey(); keyBundle = new PSKeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName, Version = KeyVersion }; @@ -58,7 +58,7 @@ public void CanSetKeyAttributeTest() PSKeyBundle expected = keyBundle; keyVaultClientMock.Setup(kv => kv.UpdateKey(VaultName, KeyName, string.Empty, - It.Is(kt => kt.Enabled == keyAttributes.Enabled + It.Is(kt => kt.Enabled == keyAttributes.Enabled && kt.Expires == keyAttributes.Expires && kt.NotBefore == keyAttributes.NotBefore && kt.KeyType == keyAttributes.KeyType @@ -81,7 +81,7 @@ public void ErrorSetKeyTest() PSKeyBundle expected = keyBundle; keyVaultClientMock.Setup(kv => kv.UpdateKey(VaultName, KeyName, string.Empty, - It.Is(kt => kt.Enabled == keyAttributes.Enabled + It.Is(kt => kt.Enabled == keyAttributes.Enabled && kt.Expires == keyAttributes.Expires && kt.NotBefore == keyAttributes.NotBefore && kt.KeyType == keyAttributes.KeyType diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs index dc72a033514f..8ec47690c5ba 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs @@ -25,13 +25,13 @@ namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests public class SetKeyVaultSecretAttributeTests : KeyVaultUnitTestBase { private SetAzureKeyVaultSecretAttribute cmdlet; - private SecretAttributes secretAttributes; + private PSSecretAttributes secretAttributes; private PSSecret secret; public SetKeyVaultSecretAttributeTests() { base.SetupTest(); - secretAttributes = new SecretAttributes(true, DateTime.UtcNow.AddYears(2), DateTime.UtcNow, "contenttype", null); + secretAttributes = new PSSecretAttributes(true, DateTime.UtcNow.AddYears(2), DateTime.UtcNow, "contenttype", null); secret = new PSSecret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = null, Attributes = secretAttributes }; cmdlet = new SetAzureKeyVaultSecretAttribute() @@ -59,7 +59,7 @@ public void CanSetSecretAttributeTest() PSSecret expected = secret; keyVaultClientMock.Setup(kv => kv.UpdateSecret(VaultName, SecretName, SecretVersion, - It.Is(st => st.Enabled == secretAttributes.Enabled + It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires && st.NotBefore == secretAttributes.NotBefore && st.ContentType == secretAttributes.ContentType @@ -80,7 +80,7 @@ public void ErrorSetSecretAttributeTest() commandRuntimeMock.Setup(cr => cr.ShouldProcess(SecretName, It.IsAny())).Returns(true); keyVaultClientMock.Setup(kv => kv.UpdateSecret(VaultName, SecretName, SecretVersion, - It.Is(st => st.Enabled == secretAttributes.Enabled + It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires && st.NotBefore == secretAttributes.NotBefore && st.ContentType == secretAttributes.ContentType diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs index 8fad6a0ccbf4..4cc43c81e1cf 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests public class SetKeyVaultSecretTests : KeyVaultUnitTestBase { private SetAzureKeyVaultSecret cmdlet; - private SecretAttributes secretAttributes; + private PSSecretAttributes secretAttributes; private SecureString secureSecretValue; private PSSecret secret; @@ -33,7 +33,7 @@ public SetKeyVaultSecretTests() { base.SetupTest(); - secretAttributes = new SecretAttributes(true, null, null, null, null); + secretAttributes = new PSSecretAttributes(true, null, null, null, null); secureSecretValue = SecretValue.ConvertToSecureString(); secret = new PSSecret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = secureSecretValue, Attributes = secretAttributes }; @@ -58,7 +58,7 @@ public void CanSetSecretTest() { PSSecret expected = secret; keyVaultClientMock.Setup(kv => kv.SetSecret(VaultName, SecretName, secureSecretValue, - It.Is(st => st.Enabled == secretAttributes.Enabled + It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires && st.NotBefore == secretAttributes.NotBefore && st.ContentType == secretAttributes.ContentType @@ -82,7 +82,7 @@ public void ErrorSetSecretTest() commandRuntimeMock.Setup(cr => cr.ShouldProcess(SecretName, It.IsAny())).Returns(true); keyVaultClientMock.Setup(kv => kv.SetSecret(VaultName, SecretName, secureSecretValue, - It.Is(st => st.Enabled == secretAttributes.Enabled + It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires && st.NotBefore == secretAttributes.NotBefore && st.ContentType == secretAttributes.ContentType diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj index 055411131d62..fb1c03acb44b 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj @@ -157,15 +157,15 @@ - - + + - + diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs index f8be10fab828..503ff40d0340 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs @@ -148,7 +148,7 @@ public override void ExecuteCmdlet() if (PassThru.IsPresent) { - this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts), true); + this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts, VaultName), true); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs index 2de6489af463..2e9dd98cae9f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs @@ -217,7 +217,7 @@ public override void ExecuteCmdlet() } } - internal KeyAttributes CreateKeyAttributes() + internal PSKeyAttributes CreateKeyAttributes() { string keyType = string.Empty; @@ -226,7 +226,7 @@ internal KeyAttributes CreateKeyAttributes() keyType = (HsmDestination.Equals(Destination, StringComparison.OrdinalIgnoreCase)) ? JsonWebKeyType.RsaHsm : JsonWebKeyType.Rsa; } - return new Models.KeyAttributes( + return new Models.PSKeyAttributes( !Disable.IsPresent, Expires, NotBefore, diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs index d80e29d48d88..e187f4ae0dc6 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs @@ -112,7 +112,7 @@ public override void ExecuteCmdlet() foreach (var contact in contacts.ContactList) { - contactsModel.Add(PSKeyVaultCertificateContact.FromKVCertificateContact(contact)); + contactsModel.Add(PSKeyVaultCertificateContact.FromKVCertificateContact(contact, VaultName)); } this.WriteObject(contactsModel, true); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs index 8ad3b83bdad8..ae9b69fe7e19 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs @@ -85,7 +85,9 @@ public override void ExecuteCmdlet() else { var issuer = this.DataServiceClient.GetCertificateIssuer(VaultName, Name); - this.WriteObject(PSKeyVaultCertificateIssuer.FromIssuer(issuer)); + var psissuer = PSKeyVaultCertificateIssuer.FromIssuer(issuer); + psissuer.VaultName = VaultName; + this.WriteObject(psissuer); } } @@ -100,7 +102,13 @@ private void GetAndWriteCertificateIssuers(string vaultName) do { var pageResults = this.DataServiceClient.GetCertificateIssuers(options); - WriteObject(pageResults, true); + var psPageResults = new List(); + foreach (var page in pageResults) + { + page.VaultName = VaultName; + psPageResults.Add(page); + } + WriteObject(psPageResults, true); } while (!string.IsNullOrEmpty(options.NextLink)); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs index 6ca0a37a869e..494727f809fd 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs @@ -81,6 +81,8 @@ public override void ExecuteCmdlet() var certificateOperation = this.DataServiceClient.GetCertificateOperation(VaultName, Name); var kvCertificateOperation = PSKeyVaultCertificateOperation.FromCertificateOperation(certificateOperation); + kvCertificateOperation.VaultName = VaultName; + kvCertificateOperation.Name = Name; this.WriteObject(kvCertificateOperation); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs index 1c0d53d7ec45..e918681d6ee9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs @@ -107,7 +107,7 @@ public override void ExecuteCmdlet() if (PassThru.IsPresent) { - this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts)); + this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts, VaultName)); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs index 771487835416..0518565120ea 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs @@ -40,6 +40,7 @@ public class RemoveAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -61,7 +62,7 @@ public class RemoveAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase /// Certificate Issuer Object /// [Parameter(Mandatory = true, - Position = 1, + Position = 0, ParameterSetName = InputObjectParameterSet, ValueFromPipeline = true, HelpMessage = "Certificate Issuer Object")] @@ -87,6 +88,7 @@ public override void ExecuteCmdlet() { if (InputObject != null) { + VaultName = InputObject.VaultName; Name = InputObject.Name; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs index 69943129a83d..43a89b98b26d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateOperation.cs @@ -29,6 +29,13 @@ namespace Microsoft.Azure.Commands.KeyVault [OutputType(typeof(PSKeyVaultCertificateOperation))] public class RemoveAzureKeyVaultCertificateOperation : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -36,6 +43,7 @@ public class RemoveAzureKeyVaultCertificateOperation : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -46,12 +54,24 @@ public class RemoveAzureKeyVaultCertificateOperation : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name.")] [ValidateNotNullOrEmpty] [Alias(Constants.CertificateName)] public string Name { get; set; } + /// + /// Operation object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Operation object")] + [ValidateNotNullOrEmpty] + public PSKeyVaultCertificateOperation InputObject { get; set; } + /// /// If present, do not ask for confirmation /// @@ -68,6 +88,12 @@ public class RemoveAzureKeyVaultCertificateOperation : KeyVaultCmdletBase public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + CertificateOperation certificateOperation = null; ConfirmAction( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultAccessPolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultAccessPolicy.cs index 9dd35686ade2..b729da4afe8d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultAccessPolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultAccessPolicy.cs @@ -15,20 +15,21 @@ using System; using System.Linq; using System.Management.Automation; -using PSKeyVaultModels = Microsoft.Azure.Commands.KeyVault.Models; -using PSKeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; using SecretPerms = Microsoft.Azure.Management.KeyVault.Models.SecretPermissions; using KeyPerms = Microsoft.Azure.Management.KeyVault.Models.KeyPermissions; using CertPerms = Microsoft.Azure.Management.KeyVault.Models.CertificatePermissions; using StoragePerms = Microsoft.Azure.Management.KeyVault.Models.StoragePermissions; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; +using Microsoft.Azure.Commands.KeyVault.Models; +using Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Set, "AzureRmKeyVaultAccessPolicy", SupportsShouldProcess = true, + DefaultParameterSetName = ByUserPrincipalName, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSKeyVaultModels.PSVault))] + [OutputType(typeof(PSVault))] public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase { private readonly string[] SecretAllExpansion = { @@ -96,6 +97,12 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase private const string ByEmailAddress = "ByEmailAddress"; private const string ForVault = "ForVault"; + private const string InputObjectByObjectId = "InputObjectByObjectId"; + private const string InputObjectByServicePrincipalName = "InputObjectByServicePrincipalName"; + private const string InputObjectByUserPrincipalName = "InputObjectByUserPrincipalName"; + private const string InputObjectByEmailAddress = "InputObjectByEmailAddress"; + private const string InputObjectForVault = "InputObjectForVault"; + #endregion #region Input Parameter Definitions @@ -106,6 +113,27 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase [Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, + ParameterSetName = ByObjectId, + HelpMessage = "Specifies the name of a key vault. This cmdlet modifies the access policy for the key vault that this parameter specifies.")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByServicePrincipalName, + HelpMessage = "Specifies the name of a key vault. This cmdlet modifies the access policy for the key vault that this parameter specifies.")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByUserPrincipalName, + HelpMessage = "Specifies the name of a key vault. This cmdlet modifies the access policy for the key vault that this parameter specifies.")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByEmailAddress, + HelpMessage = "Specifies the name of a key vault. This cmdlet modifies the access policy for the key vault that this parameter specifies.")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ForVault, HelpMessage = "Specifies the name of a key vault. This cmdlet modifies the access policy for the key vault that this parameter specifies.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } @@ -116,11 +144,63 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase [Parameter(Mandatory = false, Position = 1, ValueFromPipelineByPropertyName = true, + ParameterSetName = ByObjectId, + HelpMessage = "Specifies the name of the resource group associated with the key vault whose access policy is being modified.")] + [Parameter(Mandatory = false, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByServicePrincipalName, + HelpMessage = "Specifies the name of the resource group associated with the key vault whose access policy is being modified.")] + [Parameter(Mandatory = false, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByUserPrincipalName, + HelpMessage = "Specifies the name of the resource group associated with the key vault whose access policy is being modified.")] + [Parameter(Mandatory = false, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByEmailAddress, + HelpMessage = "Specifies the name of the resource group associated with the key vault whose access policy is being modified.")] + [Parameter(Mandatory = false, + Position = 1, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ForVault, HelpMessage = "Specifies the name of the resource group associated with the key vault whose access policy is being modified.")] [ResourceGroupCompleter] [ValidateNotNullOrEmpty()] public string ResourceGroupName { get; set; } + /// + /// Vault object + /// + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectByObjectId, + HelpMessage = "Key Vault Object")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectByServicePrincipalName, + HelpMessage = "Key Vault Object")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectByUserPrincipalName, + HelpMessage = "Key Vault Object")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectByEmailAddress, + HelpMessage = "Key Vault Object")] + [Parameter(Mandatory = true, + Position = 0, + ValueFromPipeline = true, + ParameterSetName = InputObjectForVault, + HelpMessage = "Key Vault Object")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + /// /// Service principal name /// @@ -128,6 +208,10 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByServicePrincipalName, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the service principal name of the application to which to grant permissions. Specify the application ID, also known as client ID, registered for the application in Azure Active Directory. The application with the service principal name that this parameter specifies must be registered in the Azure directory that contains your current subscription.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByServicePrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the service principal name of the application to which to grant permissions. Specify the application ID, also known as client ID, registered for the application in Azure Active Directory. The application with the service principal name that this parameter specifies must be registered in the Azure directory that contains your current subscription.")] [ValidateNotNullOrEmpty()] [Alias("SPN")] public string ServicePrincipalName { get; set; } @@ -139,6 +223,10 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByUserPrincipalName, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the user principal name of the user to whom to grant permissions. This user principal name must exist in the directory associated with the current subscription.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByUserPrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the user principal name of the user to whom to grant permissions. This user principal name must exist in the directory associated with the current subscription.")] [ValidateNotNullOrEmpty()] [Alias("UPN")] public string UserPrincipalName { get; set; } @@ -150,6 +238,10 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByObjectId, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the object ID of the user or service principal in Azure Active Directory for which to grant permissions.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the object ID of the user or service principal in Azure Active Directory for which to grant permissions.")] [ValidateNotNullOrEmpty()] public string ObjectId { get; set; } @@ -160,6 +252,10 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByEmailAddress, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the email address of the user in Azure Active Directory for which to grant permissions.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByEmailAddress, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the email address of the user in Azure Active Directory for which to grant permissions.")] [ValidateNotNullOrEmpty()] public string EmailAddress { get; set; } @@ -170,6 +266,10 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByObjectId, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the ID of application that a user must use to grant permissions.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the ID of application that a user must use to grant permissions.")] public Guid? ApplicationId { get; set; } /// @@ -191,6 +291,22 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByEmailAddress, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies key operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies key operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByServicePrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies key operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByUserPrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies key operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByEmailAddress, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies key operation permissions to grant to a user or service principal.")] [ValidateSet("decrypt", "encrypt", "unwrapKey", "wrapKey", "verify", "sign", "get", "list", "update", "create", "import", "delete", "backup", "restore", "recover", "purge", "all")] public string[] PermissionsToKeys { get; set; } @@ -213,6 +329,22 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByEmailAddress, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies secret operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies secret operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByServicePrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies secret operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByUserPrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies secret operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByEmailAddress, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies secret operation permissions to grant to a user or service principal.")] [ValidateSet("get", "list", "set", "delete", "backup", "restore", "recover", "purge", "all")] public string[] PermissionsToSecrets { get; set; } @@ -235,6 +367,22 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByEmailAddress, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies certificate operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies certificate operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByServicePrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies certificate operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByUserPrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies certificate operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByEmailAddress, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies certificate operation permissions to grant to a user or service principal.")] [ValidateSet("get", "list", "delete", "create", "import", "update", "managecontacts", "getissuers", "listissuers", "setissuers", "deleteissuers", "manageissuers", "recover", "purge", "all")] public string[] PermissionsToCertificates { get; set; } @@ -257,6 +405,22 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByEmailAddress, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies managed storage account and sas definition operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies managed storage account and sas definition operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByServicePrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies managed storage account and sas definition operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByUserPrincipalName, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies managed storage account and sas definition operation permissions to grant to a user or service principal.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByEmailAddress, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies managed storage account and sas definition operation permissions to grant to a user or service principal.")] [ValidateSet( "get", "list", "delete", "set", "update", "regeneratekey", "getsas", "listsas", "deletesas", "setsas", "all" )] public string[] PermissionsToStorage { get; set; } @@ -264,18 +428,30 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "If specified, enables secrets to be retrieved from this key vault by the Microsoft.Compute resource provider when referenced in resource creation.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectForVault, + ValueFromPipelineByPropertyName = true, + HelpMessage = "If specified, enables secrets to be retrieved from this key vault by the Microsoft.Compute resource provider when referenced in resource creation.")] public SwitchParameter EnabledForDeployment { get; set; } [Parameter(Mandatory = false, ParameterSetName = ForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "If specified, enables secrets to be retrieved from this key vault by Azure Resource Manager when referenced in templates.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectForVault, + ValueFromPipelineByPropertyName = true, + HelpMessage = "If specified, enables secrets to be retrieved from this key vault by Azure Resource Manager when referenced in templates.")] public SwitchParameter EnabledForTemplateDeployment { get; set; } [Parameter(Mandatory = false, ParameterSetName = ForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "If specified, enables secrets to be retrieved from this key vault by Azure Disk Encryption.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectForVault, + ValueFromPipelineByPropertyName = true, + HelpMessage = "If specified, enables secrets to be retrieved from this key vault by Azure Disk Encryption.")] public SwitchParameter EnabledForDiskEncryption { get; set; } /// @@ -285,6 +461,10 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = ByObjectId, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies whether the object ID needs to be validated or not.")] + [Parameter(Mandatory = false, + ParameterSetName = InputObjectByObjectId, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies whether the object ID needs to be validated or not.")] public SwitchParameter BypassObjectIdValidation { get; set; } [Parameter(Mandatory = false, @@ -295,16 +475,21 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + ResourceGroupName = InputObject.ResourceGroupName; + } if (ShouldProcess(VaultName, Properties.Resources.SetVaultAccessPolicy)) { if (ParameterSetName == ForVault && !EnabledForDeployment.IsPresent && !EnabledForTemplateDeployment.IsPresent && !EnabledForDiskEncryption.IsPresent) { - throw new ArgumentException(PSKeyVaultProperties.Resources.VaultPermissionFlagMissing); + throw new ArgumentException(Resources.VaultPermissionFlagMissing); } ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName; - PSKeyVaultModels.PSVault vault = null; + PSVault vault = null; // Get the vault to be updated if (!string.IsNullOrWhiteSpace(ResourceGroupName)) @@ -313,16 +498,16 @@ public override void ExecuteCmdlet() ResourceGroupName); if (vault == null) { - throw new ArgumentException(string.Format(PSKeyVaultProperties.Resources.VaultNotFound, VaultName, ResourceGroupName)); + throw new ArgumentException(string.Format(Resources.VaultNotFound, VaultName, ResourceGroupName)); } if (!string.IsNullOrWhiteSpace(this.ObjectId) && !this.IsValidObjectIdSyntax(this.ObjectId)) { - throw new ArgumentException(PSKeyVaultProperties.Resources.InvalidObjectIdSyntax); + throw new ArgumentException(Resources.InvalidObjectIdSyntax); } // Update vault policies - PSKeyVaultModels.PSVaultAccessPolicy[] updatedListOfAccessPolicies = vault.AccessPolicies; + PSVaultAccessPolicy[] updatedListOfAccessPolicies = vault.AccessPolicies; if (!string.IsNullOrEmpty(UserPrincipalName) || !string.IsNullOrEmpty(ServicePrincipalName) || !string.IsNullOrWhiteSpace(this.ObjectId) @@ -335,11 +520,11 @@ public override void ExecuteCmdlet() } if (ApplicationId.HasValue && ApplicationId.Value == Guid.Empty) - throw new ArgumentException(PSKeyVaultProperties.Resources.InvalidApplicationId); + throw new ArgumentException(Resources.InvalidApplicationId); //All permission arrays cannot be null if ( PermissionsToKeys == null && PermissionsToSecrets == null && PermissionsToCertificates == null && PermissionsToStorage == null ) - throw new ArgumentException(PSKeyVaultProperties.Resources.PermissionsNotSpecified); + throw new ArgumentException(Resources.PermissionsNotSpecified); else { // Expand the permissions sets. @@ -347,7 +532,7 @@ public override void ExecuteCmdlet() || PermissionsToSecrets != null && PermissionsToSecrets.Contains("all", StringComparer.OrdinalIgnoreCase) || PermissionsToCertificates!= null && PermissionsToCertificates.Contains("all", StringComparer.OrdinalIgnoreCase)) { - WriteWarning(PSKeyVaultProperties.Resources.AllPermissionExpansionWarning); + WriteWarning(Resources.AllPermissionExpansionWarning); } PermissionsToKeys = ExpandPermissionSet(PermissionsToKeys, KeyAllExpansion); @@ -376,7 +561,7 @@ public override void ExecuteCmdlet() updatedListOfAccessPolicies = vault.AccessPolicies.Where(ap => !MatchVaultAccessPolicyIdentity(ap, objId, this.ApplicationId)).ToArray(); if ( ( keys != null && keys.Length > 0 ) || ( secrets != null && secrets.Length > 0 ) || ( certificates != null && certificates.Length > 0 ) || ( managedStorage != null && managedStorage.Length > 0 ) ) { - var policy = new PSKeyVaultModels.PSVaultAccessPolicy( vault.TenantId, objId, this.ApplicationId, keys, secrets, certificates, managedStorage ); + var policy = new PSVaultAccessPolicy( vault.TenantId, objId, this.ApplicationId, keys, secrets, certificates, managedStorage ); updatedListOfAccessPolicies = updatedListOfAccessPolicies.Concat(new[] { policy }).ToArray(); } @@ -419,7 +604,7 @@ private string[] ExpandPermissionSet(string[] permissions, string[] allExpansion }).Distinct(StringComparer.OrdinalIgnoreCase).ToArray(); // Allow "all" + other perms, but after the expansion, only allow distinct values. } - private bool MatchVaultAccessPolicyIdentity(PSKeyVaultModels.PSVaultAccessPolicy ap, string objectId, Guid? applicationId) + private bool MatchVaultAccessPolicyIdentity(PSVaultAccessPolicy ap, string objectId, Guid? applicationId) { return ap.ApplicationId == applicationId && string.Equals(ap.ObjectId, objectId, StringComparison.OrdinalIgnoreCase); } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs index 7d9a99e04917..9cf6e40522d7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs @@ -21,10 +21,18 @@ namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Set, "AzureKeyVaultCertificateAttribute", SupportsShouldProcess = true, + DefaultParameterSetName = ByNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSKeyVaultCertificate))] public class SetAzureKeyVaultCertificateAttribute : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string ByNameParameterSet = "ByName"; + private const string ByInputObjectParameterSet = "ByInputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -32,6 +40,7 @@ public class SetAzureKeyVaultCertificateAttribute : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = ByNameParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -42,17 +51,35 @@ public class SetAzureKeyVaultCertificateAttribute : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = ByNameParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] [ValidateNotNullOrEmpty] [Alias(Constants.CertificateName)] public string Name { get; set; } + /// + /// Certificate Object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ByInputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Certificate object")] + [ValidateNotNullOrEmpty] + public PSKeyVaultCertificate InputObject { get; set; } + /// /// Certificate version. /// [Parameter(Mandatory = false, Position = 2, + ParameterSetName = ByNameParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Secret version. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment, secret name and secret version.")] + [Parameter(Mandatory = false, + Position = 1, + ParameterSetName = ByInputObjectParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Secret version. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment, secret name and secret version.")] [Alias("CertificateVersion")] @@ -83,6 +110,12 @@ public class SetAzureKeyVaultCertificateAttribute : KeyVaultCmdletBase public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + if (ShouldProcess(Name, Properties.Resources.SetCertificateAttributes)) { var certificateBundle = DataServiceClient.UpdateCertificate( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs index e100877091a4..18f4c25c57b2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs @@ -16,7 +16,7 @@ using System; using System.Management.Automation; using System.Security; -using PSKeyVaultProperties = Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.Commands.KeyVault.Properties; namespace Microsoft.Azure.Commands.KeyVault { @@ -36,6 +36,9 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase private const string ExpandedParameterSet = "Expanded"; private const string ByValueParameterSet = "ByValue"; + private const string InputObjectExpandedParameterSet = "InputObjectExpanded"; + private const string InputObjectByValueParameterSet = "InputObjectByValue"; + #endregion #region Input Parameter Definitions @@ -45,11 +48,33 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = ExpandedParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = ByValueParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } + /// + /// Vault object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectExpandedParameterSet, + ValueFromPipeline = true, + HelpMessage = "Key Vault Object")] + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectByValueParameterSet, + ValueFromPipeline = true, + HelpMessage = "Key Vault Object")] + [ValidateNotNullOrEmpty] + public PSVault InputObject { get; set; } + /// /// Name /// @@ -68,6 +93,9 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase [Parameter(ParameterSetName = ExpandedParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the type of the issuer.")] + [Parameter(ParameterSetName = InputObjectExpandedParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the type of the issuer.")] [ValidateNotNullOrEmpty] public string IssuerProvider { get; set; } @@ -77,6 +105,9 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase [Parameter(ParameterSetName = ExpandedParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the account id to be used with the issuer.")] + [Parameter(ParameterSetName = InputObjectExpandedParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the account id to be used with the issuer.")] [ValidateNotNullOrEmpty] public string AccountId { get; set; } @@ -86,6 +117,9 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase [Parameter(ParameterSetName = ExpandedParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the api key to be used with the issuer.")] + [Parameter(ParameterSetName = InputObjectExpandedParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the api key to be used with the issuer.")] [ValidateNotNullOrEmpty] public SecureString ApiKey { get; set; } @@ -95,6 +129,9 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase [Parameter(ParameterSetName = ExpandedParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the organization details to be used with the issuer.")] + [Parameter(ParameterSetName = InputObjectExpandedParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the organization details to be used with the issuer.")] [ValidateNotNullOrEmpty] public PSKeyVaultCertificateOrganizationDetails OrganizationDetails { get; set; } @@ -107,6 +144,12 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase /// [Parameter(Mandatory = true, ParameterSetName = ByValueParameterSet, + ValueFromPipeline = true, + ValueFromPipelineByPropertyName = true, + HelpMessage = "Specifies the certificate issuer to set.")] + [Parameter(Mandatory = true, + ParameterSetName = InputObjectByValueParameterSet, + ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the certificate issuer to set.")] [ValidateNotNullOrEmpty] @@ -122,33 +165,31 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + } + if (ShouldProcess(Name, Properties.Resources.SetCertificateIssuer)) { PSKeyVaultCertificateIssuer issuerToUse; - switch (ParameterSetName) + if (Issuer != null) { - case ExpandedParameterSet: - - issuerToUse = new PSKeyVaultCertificateIssuer - { - Name = Name, - IssuerProvider = IssuerProvider, - AccountId = AccountId, - ApiKey = ApiKey, - OrganizationDetails = OrganizationDetails, - }; - - break; - - case ByValueParameterSet: - issuerToUse = Issuer; - break; - - default: - throw new ArgumentException(PSKeyVaultProperties.Resources.BadParameterSetName); + issuerToUse = Issuer; + } + else + { + issuerToUse = new PSKeyVaultCertificateIssuer + { + Name = Name, + IssuerProvider = IssuerProvider, + AccountId = AccountId, + ApiKey = ApiKey, + OrganizationDetails = OrganizationDetails, + }; } var resultantIssuer = this.DataServiceClient.SetCertificateIssuer( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs index 9df38050de63..57e7bdf63bb1 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs @@ -15,7 +15,6 @@ using Microsoft.Azure.Commands.KeyVault.Models; using System; using System.Collections.Generic; -using System.Globalization; using System.Management.Automation; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; @@ -29,14 +28,15 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsCommon.Set, CmdletNoun.AzureKeyVaultCertificatePolicy, SupportsShouldProcess = true, - DefaultParameterSetName = ExpandedParameterSet, + DefaultParameterSetName = ExpandedRenewPercentageParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSKeyVaultCertificatePolicy))] public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase { #region Parameter Set Names - private const string ExpandedParameterSet = "Expanded"; + private const string ExpandedRenewPercentageParameterSet = "ExpandedRenewPercentage"; + private const string ExpandedRenewNumberParameterSet = "ExpandedRenewNumber"; private const string ByValueParameterSet = "ByValue"; #endregion @@ -64,11 +64,46 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase [Alias(Constants.CertificateName)] public string Name { get; set; } + /// + /// CertificatePolicy + /// + [Parameter(Mandatory = true, + Position = 2, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ByValueParameterSet, + HelpMessage = "Specifies the certificate policy.")] + [ValidateNotNull] + [Alias("CertificatePolicy")] + public PSKeyVaultCertificatePolicy InputObject { get; set; } + + /// + /// RenewAtNumberOfDaysBeforeExpiry + /// + [Parameter(Mandatory = true, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, + HelpMessage = "Specifies the number of days after which the automatic process for the certificate renewal begins.")] + [ValidateRange(1, int.MaxValue)] + public int? RenewAtNumberOfDaysBeforeExpiry { get; set; } + + /// + /// RenewAtPercentageLifetime + /// + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies the percentage of the lifetime after which the automatic process for the certificate renewal begins.")] + [ValidateRange(0, 99)] + public int? RenewAtPercentageLifetime { get; set; } + /// /// SecretContentType /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies the content type of the resulting Key Vault secret.")] + [Parameter(ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, HelpMessage = "Specifies the content type of the resulting Key Vault secret.")] [ValidateSet(Constants.Pkcs12ContentType, Constants.PemContentType)] public string SecretContentType { get; set; } @@ -77,7 +112,10 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// ReuseKeyOnRenewal /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies whether the certificate should use the old key during renewal.")] + [Parameter(ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, HelpMessage = "Specifies whether the certificate should use the old key during renewal.")] public bool? ReuseKeyOnRenewal { get; set; } @@ -85,7 +123,10 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// ReuseKeyOnRenewal /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies whether the certificate policy is enabled or not.")] + [Parameter(ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, HelpMessage = "Specifies whether the certificate policy is enabled or not.")] public SwitchParameter Disabled { get; set; } @@ -93,7 +134,10 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// SubjectName /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies the subject name of the certificate.")] + [Parameter(ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, HelpMessage = "Specifies the subject name of the certificate.")] public string SubjectName { get; set; } @@ -101,15 +145,21 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// DnsNames /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, - HelpMessage = "Specifies the dns names in the certificate.")] + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies the subject name of the certificate.")] + [Parameter(ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, + HelpMessage = "Specifies the subject name of the certificate.")] public List DnsNames { get; set; } /// /// Key Usage /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies the key usages in the certificate.")] + [Parameter(ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, HelpMessage = "Specifies the key usages in the certificate.")] public List KeyUsage { get; set; } @@ -117,7 +167,10 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// Ekus /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies the enhanced key usages in the certificate.")] + [Parameter(ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, HelpMessage = "Specifies the enhanced key usages in the certificate.")] public List Ekus { get; set; } @@ -125,7 +178,10 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// ValidityInMonths /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies the number of months the certificate will be valid.")] + [Parameter(ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, HelpMessage = "Specifies the number of months the certificate will be valid.")] public int? ValidityInMonths { get; set; } @@ -133,7 +189,10 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// IssuerName /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, + HelpMessage = "Specifies the name of the issuer for this certificate.")] + [Parameter(ValueFromPipelineByPropertyName = true, + ParameterSetName = ExpandedRenewNumberParameterSet, HelpMessage = "Specifies the name of the issuer for this certificate.")] public string IssuerName { get; set; } @@ -141,25 +200,12 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// CertificateType /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, HelpMessage = "Specifies the type of certificate to the issuer.")] - public string CertificateType { get; set; } - - /// - /// RenewAtNumberOfDaysBeforeExpiry - /// - [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, - HelpMessage = "Specifies the number of days after which the automatic process for the certificate renewal begins.")] - public int? RenewAtNumberOfDaysBeforeExpiry { get; set; } - - /// - /// RenewAtPercentageLifetime - /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, - HelpMessage = "Specifies the percentage of the lifetime after which the automatic process for the certificate renewal begins.")] - public int? RenewAtPercentageLifetime { get; set; } + ParameterSetName = ExpandedRenewNumberParameterSet, + HelpMessage = "Specifies the type of certificate to the issuer.")] + public string CertificateType { get; set; } /// /// EmailAtNumberOfDaysBeforeExpiry @@ -187,19 +233,12 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// KeyNotExportable /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ExpandedParameterSet, + ParameterSetName = ExpandedRenewPercentageParameterSet, HelpMessage = "Specifies whether the key is not exportable.")] - public SwitchParameter KeyNotExportable { get; set; } - - /// - /// CertificatePolicy - /// [Parameter(ValueFromPipelineByPropertyName = true, - ParameterSetName = ByValueParameterSet, - Position = 2, - HelpMessage = "Specifies the certificate policy.")] - [ValidateNotNull] - public PSKeyVaultCertificatePolicy CertificatePolicy { get; set; } + ParameterSetName = ExpandedRenewNumberParameterSet, + HelpMessage = "Specifies whether the key is not exportable.")] + public SwitchParameter KeyNotExportable { get; set; } /// /// PassThru parameter @@ -208,26 +247,22 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase public SwitchParameter PassThru { get; set; } #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { if (ShouldProcess(Name, Properties.Resources.SetCertificatePolicy)) { - PSKeyVaultCertificatePolicy policy; + PSKeyVaultCertificatePolicy policy = new PSKeyVaultCertificatePolicy(); switch (ParameterSetName) { - case ExpandedParameterSet: + case ExpandedRenewNumberParameterSet: + case ExpandedRenewPercentageParameterSet: // Validate input parameters ValidateSubjectName(); ValidateDnsNames(); ValidateKeyUsage(); ValidateEkus(); - ValidateRenewAtNumberOfDaysBeforeExpiry(); - ValidateRenewAtPercentageLifetime(); - - // Validate combinations of parameters - ValidateBothPercentageAndNumberOfDaysAreNotPresent(); policy = new PSKeyVaultCertificatePolicy { @@ -256,11 +291,8 @@ protected override void ProcessRecord() break; case ByValueParameterSet: - policy = CertificatePolicy; + policy = InputObject; break; - - default: - throw new ArgumentException(PSKeyVaultProperties.Resources.BadParameterSetName); } var resultantPolicy = DataServiceClient.UpdateCertificatePolicy(VaultName, Name, policy.ToCertificatePolicy()); @@ -272,42 +304,6 @@ protected override void ProcessRecord() } } - private void ValidateBothPercentageAndNumberOfDaysAreNotPresent() - { - if (RenewAtNumberOfDaysBeforeExpiry != null && - RenewAtPercentageLifetime != null) - { - throw new ArgumentException("Both RenewAtNumberOfDaysBeforeExpiry and RenewAtPercentageLifetime cannot be specified."); - } - } - - private void ValidateRenewAtPercentageLifetime() - { - if (RenewAtPercentageLifetime != null) - { - if (RenewAtPercentageLifetime < 0) - { - throw new ArgumentException("RenewAtPercentageLifetime must be larger than or equal to 0."); - } - - if (RenewAtPercentageLifetime >= 100) - { - throw new ArgumentException("RenewAtPercentageLifetime must be smaller than 100."); - } - } - } - - private void ValidateRenewAtNumberOfDaysBeforeExpiry() - { - if (RenewAtNumberOfDaysBeforeExpiry != null) - { - if (RenewAtNumberOfDaysBeforeExpiry <= 0) - { - throw new ArgumentException("RenewAtNumberOfDaysBeforeExpiry must be larger than 0."); - } - } - } - private void ValidateKeyUsage() { if (KeyUsage != null) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs index 12bec4fbc3f7..31d2447fb9ea 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs @@ -25,10 +25,18 @@ namespace Microsoft.Azure.Commands.KeyVault [Alias("Set-AzureKeyVaultKey")] [Cmdlet(VerbsCommon.Set, "AzureKeyVaultKeyAttribute", SupportsShouldProcess = true, + DefaultParameterSetName = DefaultParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSKeyBundle))] public class SetAzureKeyVaultKeyAttribute : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -36,6 +44,7 @@ public class SetAzureKeyVaultKeyAttribute : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -46,12 +55,24 @@ public class SetAzureKeyVaultKeyAttribute : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] [ValidateNotNullOrEmpty] [Alias(Constants.KeyName)] public string Name { get; set; } + /// + /// key object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Key object")] + [ValidateNotNullOrEmpty] + public PSKeyBundle InputObject { get; set; } + /// /// Key version. /// @@ -109,13 +130,19 @@ public class SetAzureKeyVaultKeyAttribute : KeyVaultCmdletBase public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + if (ShouldProcess(Name, Properties.Resources.SetKeyAttribute)) { var keyBundle = DataServiceClient.UpdateKey( VaultName, Name, Version ?? string.Empty, - new KeyAttributes(Enable, Expires, NotBefore, null, KeyOps, Tag)); + new PSKeyAttributes(Enable, Expires, NotBefore, null, KeyOps, Tag)); if (PassThru) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs index 8ca830bfbc9a..1a767f5251c2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs @@ -22,10 +22,18 @@ namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Set, "AzureKeyVaultSecret", SupportsShouldProcess = true, + DefaultParameterSetName = DefaultParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSSecret))] public class SetAzureKeyVaultSecret : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -33,6 +41,7 @@ public class SetAzureKeyVaultSecret : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -43,12 +52,24 @@ public class SetAzureKeyVaultSecret : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] [ValidateNotNullOrEmpty] [Alias(Constants.SecretName)] public string Name { get; set; } + /// + /// Secret object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Secret object")] + [ValidateNotNullOrEmpty] + public PSSecret InputObject { get; set; } + /// /// Secret value /// @@ -101,13 +122,19 @@ public class SetAzureKeyVaultSecret : KeyVaultCmdletBase public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + if (ShouldProcess(Name, Properties.Resources.SetSecret)) { var secret = DataServiceClient.SetSecret( VaultName, Name, SecretValue, - new SecretAttributes(!Disable.IsPresent, Expires, NotBefore, ContentType, Tag)); + new PSSecretAttributes(!Disable.IsPresent, Expires, NotBefore, ContentType, Tag)); WriteObject(secret); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs index 7c78c95a313c..1e7c891e71bf 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs @@ -25,6 +25,13 @@ namespace Microsoft.Azure.Commands.KeyVault [OutputType(typeof(PSSecret))] public class SetAzureKeyVaultSecretAttribute : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -32,6 +39,7 @@ public class SetAzureKeyVaultSecretAttribute : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -42,12 +50,24 @@ public class SetAzureKeyVaultSecretAttribute : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] [ValidateNotNullOrEmpty] [Alias(Constants.SecretName)] public string Name { get; set; } + /// + /// Secret object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Secret object")] + [ValidateNotNullOrEmpty] + public PSSecret InputObject { get; set; } + /// /// Key version. /// @@ -109,13 +129,19 @@ public class SetAzureKeyVaultSecretAttribute : KeyVaultCmdletBase public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + if (ShouldProcess(Name, Properties.Resources.SetSecretAttribute)) { var secret = DataServiceClient.UpdateSecret( VaultName, Name, Version ?? string.Empty, - new SecretAttributes(Enable, Expires, NotBefore, ContentType, Tag)); + new PSSecretAttributes(Enable, Expires, NotBefore, ContentType, Tag)); if (PassThru) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/StopAzureKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/StopAzureKeyVaultCertificateOperation.cs index 60f6c49d8e52..dfbf51dd993e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/StopAzureKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/StopAzureKeyVaultCertificateOperation.cs @@ -24,11 +24,19 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsLifecycle.Stop, CmdletNoun.AzureKeyVaultCertificateOperation, SupportsShouldProcess = true, + DefaultParameterSetName = DefaultParameterSet, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSKeyVaultCertificateOperation))] public class StopAzureKeyVaultCertificateOperation : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -36,6 +44,7 @@ public class StopAzureKeyVaultCertificateOperation : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -46,12 +55,24 @@ public class StopAzureKeyVaultCertificateOperation : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate operation from vault name, currently selected environment and certificate name.")] [ValidateNotNullOrEmpty] [Alias(Constants.CertificateName)] public string Name { get; set; } + /// + /// Operation object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Operation object")] + [ValidateNotNullOrEmpty] + public PSKeyVaultCertificateOperation InputObject { get; set; } + /// /// If present, do not ask for confirmation /// @@ -60,8 +81,14 @@ public class StopAzureKeyVaultCertificateOperation : KeyVaultCmdletBase #endregion - protected override void ProcessRecord() + public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + CertificateOperation certificateOperation = null; ConfirmAction( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultCertificateRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultCertificateRemoval.cs index 06bcc0d12837..e881c23cacee 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultCertificateRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultCertificateRemoval.cs @@ -19,11 +19,19 @@ namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet( VerbsCommon.Undo, "AzureKeyVaultCertificateRemoval", - SupportsShouldProcess = true, - HelpUri = Constants.KeyVaultHelpUri )] + SupportsShouldProcess = true, + DefaultParameterSetName = DefaultParameterSet, + HelpUri = Constants.KeyVaultHelpUri )] [OutputType( typeof( CertificateBundle ) )] public class UndoAzureKeyVaultCertificateRemoval : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -31,6 +39,7 @@ public class UndoAzureKeyVaultCertificateRemoval : KeyVaultCmdletBase /// [Parameter( Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment." )] [ValidateNotNullOrEmpty] @@ -41,16 +50,34 @@ public class UndoAzureKeyVaultCertificateRemoval : KeyVaultCmdletBase /// [Parameter( Mandatory = true, Position = 1, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name." )] [ValidateNotNullOrEmpty] [Alias( Constants.CertificateName )] public string Name { get; set; } + /// + /// Certificate object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Deleted Certificate object")] + [ValidateNotNullOrEmpty] + public PSDeletedKeyVaultCertificate InputObject { get; set; } + #endregion - public override void ExecuteCmdlet( ) + public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + if ( ShouldProcess( Name, Properties.Resources.RecoverCertificate ) ) { CertificateBundle certificate = DataServiceClient.RecoverCertificate(VaultName, Name); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs index 1695e590bb00..49edd8563444 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs @@ -18,11 +18,19 @@ namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Undo, "AzureKeyVaultKeyRemoval", - SupportsShouldProcess = true, - HelpUri = Constants.KeyVaultHelpUri)] + SupportsShouldProcess = true, + DefaultParameterSetName = DefaultParameterSet, + HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSKeyBundle))] public class UndoAzureKeyVaultKeyRemoval : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -30,6 +38,7 @@ public class UndoAzureKeyVaultKeyRemoval : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -40,16 +49,34 @@ public class UndoAzureKeyVaultKeyRemoval : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name.")] [ValidateNotNullOrEmpty] [Alias(Constants.KeyName)] public string Name { get; set; } + /// + /// Key object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Deleted key object")] + [ValidateNotNullOrEmpty] + public PSDeletedKeyBundle InputObject { get; set; } + #endregion public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + if (ShouldProcess(Name, Properties.Resources.RecoverKey)) { PSKeyBundle recoveredKey = DataServiceClient.RecoverKey(VaultName, Name); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs index 5de99fca8984..f916cfbb8da3 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs @@ -24,11 +24,11 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { public interface IKeyVaultDataServiceClient { - PSKeyBundle CreateKey(string vaultName, string keyName, KeyAttributes keyAttributes); + PSKeyBundle CreateKey(string vaultName, string keyName, PSKeyAttributes keyAttributes); - PSKeyBundle ImportKey(string vaultName, string keyName, KeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm); + PSKeyBundle ImportKey(string vaultName, string keyName, PSKeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm); - PSKeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, KeyAttributes keyAttributes); + PSKeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, PSKeyAttributes keyAttributes); PSKeyBundle GetKey(string vaultName, string keyName, string keyVersion); @@ -46,9 +46,9 @@ public interface IKeyVaultDataServiceClient PSKeyBundle RecoverKey(string vaultName, string keyName); - PSSecret SetSecret(string vaultName, string secretName, SecureString secretValue, SecretAttributes secretAttributes); + PSSecret SetSecret(string vaultName, string secretName, SecureString secretValue, PSSecretAttributes secretAttributes); - PSSecret UpdateSecret(string vaultName, string secretName, string secretVersion, SecretAttributes secretAttributes); + PSSecret UpdateSecret(string vaultName, string secretName, string secretVersion, PSSecretAttributes secretAttributes); PSSecret GetSecret(string vaultName, string secretName, string secretVersion); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs index 59a728fe684a..bffecde35fd6 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs @@ -58,7 +58,7 @@ public KeyVaultDataServiceClient() { } - public PSKeyBundle CreateKey(string vaultName, string keyName, KeyAttributes keyAttributes) + public PSKeyBundle CreateKey(string vaultName, string keyName, PSKeyAttributes keyAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -179,7 +179,7 @@ public CertificateBundle ImportCertificate(string vaultName, string certName, X5 return certBundle; } - public PSKeyBundle ImportKey(string vaultName, string keyName, KeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm) + public PSKeyBundle ImportKey(string vaultName, string keyName, PSKeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -214,7 +214,7 @@ public PSKeyBundle ImportKey(string vaultName, string keyName, KeyAttributes key return new PSKeyBundle(keyBundle, this.vaultUriHelper); } - public PSKeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, KeyAttributes keyAttributes) + public PSKeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, PSKeyAttributes keyAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -492,7 +492,7 @@ public Contacts SetCertificateContacts(string vaultName, Contacts contacts) return outputContacts; } - public PSSecret SetSecret(string vaultName, string secretName, SecureString secretValue, SecretAttributes secretAttributes) + public PSSecret SetSecret(string vaultName, string secretName, SecureString secretValue, PSSecretAttributes secretAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -521,7 +521,7 @@ public PSSecret SetSecret(string vaultName, string secretName, SecureString secr return new PSSecret(secret, this.vaultUriHelper); } - public PSSecret UpdateSecret(string vaultName, string secretName, string secretVersion, SecretAttributes secretAttributes) + public PSSecret UpdateSecret(string vaultName, string secretName, string secretVersion, PSSecretAttributes secretAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs index e97fa39e302a..4713ca933967 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs @@ -41,5 +41,7 @@ internal PSCertificateIssuerIdentityItem(IssuerBundle issuer) public string Name { get; set; } public string IssuerProvider { get; private set; } + + public string VaultName { get; set; } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyAttributes.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyAttributes.cs similarity index 91% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyAttributes.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyAttributes.cs index 94fbc0920856..3c925c344b77 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyAttributes.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyAttributes.cs @@ -21,12 +21,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models /// /// Key attributes from PSH perspective /// - public class KeyAttributes + public class PSKeyAttributes { - public KeyAttributes() + public PSKeyAttributes() { } - internal KeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string keyType, + internal PSKeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string keyType, string[] keyOps, Hashtable tags) { this.Enabled = enabled; @@ -37,7 +37,7 @@ internal KeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, st this.Tags = tags; } - internal KeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string keyType, + internal PSKeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string keyType, string[] keyOps, DateTime? created, DateTime? updated, string deletionRecoveryLevel, IDictionary tags) { this.Enabled = enabled; @@ -87,7 +87,7 @@ public Dictionary TagsDirectionary } } - public static explicit operator Azure.KeyVault.Models.KeyAttributes(KeyAttributes attr) + public static explicit operator Azure.KeyVault.Models.KeyAttributes(PSKeyAttributes attr) { return new Azure.KeyVault.Models.KeyAttributes() { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyBundle.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyBundle.cs similarity index 95% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyBundle.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyBundle.cs index 24d12089d22f..76fd5aff63eb 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyBundle.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyBundle.cs @@ -34,7 +34,7 @@ internal PSKeyBundle(Azure.KeyVault.Models.KeyBundle keyBundle, VaultUriHelper v SetObjectIdentifier(vaultUriHelper, keyBundle.KeyIdentifier); Key = keyBundle.Key; - Attributes = new KeyAttributes( + Attributes = new PSKeyAttributes( keyBundle.Attributes.Enabled, keyBundle.Attributes.Expires, keyBundle.Attributes.NotBefore, @@ -46,7 +46,7 @@ internal PSKeyBundle(Azure.KeyVault.Models.KeyBundle keyBundle, VaultUriHelper v keyBundle.Tags); } - public KeyAttributes Attributes { get; set; } + public PSKeyAttributes Attributes { get; set; } public JsonWebKey Key { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateContact.cs index 27706d341f6d..0026e1c4fed0 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateContact.cs @@ -21,15 +21,18 @@ public class PSKeyVaultCertificateContact { public string Email { get; set; } - internal static PSKeyVaultCertificateContact FromKVCertificateContact(Contact contact) + public string VaultName { get; set; } + + internal static PSKeyVaultCertificateContact FromKVCertificateContact(Contact contact, string vaultName) { return new PSKeyVaultCertificateContact { + VaultName = vaultName, Email = contact.EmailAddress, }; } - internal static List FromKVCertificateContacts(Contacts contacts) + internal static List FromKVCertificateContacts(Contacts contacts, string vaultName) { var result = new List(); @@ -37,7 +40,7 @@ internal static List FromKVCertificateContacts(Con { foreach (var contact in contacts.ContactList) { - result.Add(FromKVCertificateContact(contact)); + result.Add(FromKVCertificateContact(contact, vaultName)); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs index e94018c28a4f..3d2e67686995 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs @@ -25,6 +25,8 @@ public class PSKeyVaultCertificateIssuer public SecureString ApiKey { get; set; } public PSKeyVaultCertificateOrganizationDetails OrganizationDetails { get; set; } + public string VaultName { get; set; } + internal static PSKeyVaultCertificateIssuer FromIssuer(IssuerBundle issuer) { if (issuer == null) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOperation.cs index 1388d935501c..92981e44d527 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateOperation.cs @@ -30,6 +30,9 @@ public class PSKeyVaultCertificateOperation public string ErrorCode { get; private set; } public string ErrorMessage { get; private set; } + public string Name { get; set; } + public string VaultName { get; set; } + internal static PSKeyVaultCertificateOperation FromCertificateOperation(CertificateOperation certificateOperation) { if (certificateOperation == null) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs index 5e059b36ad9a..3054bc1d97b3 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs @@ -36,7 +36,7 @@ internal PSSecret(Azure.KeyVault.Models.SecretBundle secret, VaultUriHelper vaul if (secret.Value != null) SecretValue = secret.Value.ConvertToSecureString(); - Attributes = new SecretAttributes( + Attributes = new PSSecretAttributes( secret.Attributes.Enabled, secret.Attributes.Expires, secret.Attributes.NotBefore, @@ -59,7 +59,7 @@ public string SecretValueText return text; } } - public SecretAttributes Attributes { get; set; } + public PSSecretAttributes Attributes { get; set; } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/SecretAttributes.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretAttributes.cs similarity index 90% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/SecretAttributes.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretAttributes.cs index 10c72e976a9b..bb9ecb4d8d54 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/SecretAttributes.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretAttributes.cs @@ -21,12 +21,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models /// /// Secret attributes from PSH perspective /// - public class SecretAttributes + public class PSSecretAttributes { - public SecretAttributes() + public PSSecretAttributes() { } - internal SecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string contentType, Hashtable tags) + internal PSSecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string contentType, Hashtable tags) { this.Enabled = enabled; this.Expires = expires; @@ -35,7 +35,7 @@ internal SecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, this.Tags = tags; } - internal SecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, + internal PSSecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, DateTime? created, DateTime? updated, string contentType, string deletionRecoveryLevel, IDictionary tags) { this.Enabled = enabled; @@ -83,7 +83,7 @@ public Dictionary TagsDictionary } } - public static explicit operator Azure.KeyVault.Models.SecretAttributes(SecretAttributes attr) + public static explicit operator Azure.KeyVault.Models.SecretAttributes(PSSecretAttributes attr) { return new Azure.KeyVault.Models.SecretAttributes { From 6c3c37d1d4bc5f556d9b00844c88eab6b020751b Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Thu, 1 Mar 2018 11:41:42 -0800 Subject: [PATCH 06/19] add help files --- .../Commands/AddAzureKeyVaultKey.cs | 4 - .../Commands/BackupAzureKeyVaultKey.cs | 1 + .../Commands/BackupAzureKeyVaultSecret.cs | 1 + .../ImportAzureKeyVaultCertificate.cs | 2 - .../Commands/RestoreAzureKeyVaultSecret.cs | 2 +- .../Commands/UndoAzureKeyVaultRemoval.cs | 33 ++++- .../UndoAzureKeyVaultSecretRemoval.cs | 31 ++++- .../help/Add-AzureKeyVaultCertificate.md | 14 +- .../Add-AzureKeyVaultCertificateContact.md | 59 ++++++-- .../help/Add-AzureKeyVaultKey.md | 66 ++++++--- .../Add-AzureKeyVaultManagedStorageAccount.md | 12 +- .../help/AzureRM.KeyVault.md | 2 +- .../help/Backup-AzureKeyVaultKey.md | 18 +-- .../help/Backup-AzureKeyVaultSecret.md | 40 +++--- .../help/Get-AzureKeyVaultCertificate.md | 75 ++++++---- .../Get-AzureKeyVaultCertificateContact.md | 51 ++++++- .../Get-AzureKeyVaultCertificateIssuer.md | 37 +++-- .../Get-AzureKeyVaultCertificateOperation.md | 32 ++++- .../Get-AzureKeyVaultCertificatePolicy.md | 32 ++++- .../help/Get-AzureKeyVaultKey.md | 66 ++++++--- .../Get-AzureKeyVaultManagedStorageAccount.md | 4 +- ...zureKeyVaultManagedStorageSasDefinition.md | 4 +- .../help/Get-AzureKeyVaultSecret.md | 66 ++++++--- .../help/Get-AzureRmKeyVault.md | 24 ++-- .../help/Import-AzureKeyVaultCertificate.md | 32 ++--- ...KeyVaultCertificateAdministratorDetails.md | 12 +- ...eKeyVaultCertificateOrganizationDetails.md | 14 +- .../New-AzureKeyVaultCertificatePolicy.md | 114 ++++++++++----- .../help/New-AzureRmKeyVault.md | 53 ++++--- .../help/Remove-AzureKeyVaultCertificate.md | 42 ++++-- .../Remove-AzureKeyVaultCertificateContact.md | 14 +- .../Remove-AzureKeyVaultCertificateIssuer.md | 36 ++++- ...emove-AzureKeyVaultCertificateOperation.md | 36 ++++- .../help/Remove-AzureKeyVaultKey.md | 38 +++-- ...move-AzureKeyVaultManagedStorageAccount.md | 8 +- ...zureKeyVaultManagedStorageSasDefinition.md | 8 +- .../help/Remove-AzureKeyVaultSecret.md | 38 +++-- .../help/Remove-AzureRmKeyVault.md | 41 +++++- .../Remove-AzureRmKeyVaultAccessPolicy.md | 130 +++++++++++------ .../help/Restore-AzureKeyVaultKey.md | 38 +++-- .../help/Restore-AzureKeyVaultSecret.md | 36 ++++- .../Set-AzureKeyVaultCertificateAttribute.md | 39 ++++-- .../Set-AzureKeyVaultCertificateIssuer.md | 73 +++++++--- .../Set-AzureKeyVaultCertificatePolicy.md | 129 +++++++++-------- .../help/Set-AzureKeyVaultKeyAttribute.md | 43 ++++-- ...zureKeyVaultManagedStorageSasDefinition.md | 40 +++--- .../help/Set-AzureKeyVaultSecret.md | 43 ++++-- .../help/Set-AzureKeyVaultSecretAttribute.md | 43 ++++-- .../help/Set-AzureRmKeyVaultAccessPolicy.md | 131 ++++++++++++------ .../Stop-AzureKeyVaultCertificateOperation.md | 34 ++++- .../Undo-AzureKeyVaultCertificateRemoval.md | 32 ++++- .../help/Undo-AzureKeyVaultKeyRemoval.md | 32 ++++- .../help/Undo-AzureKeyVaultSecretRemoval.md | 32 ++++- .../help/Undo-AzureRmKeyVaultRemoval.md | 36 ++++- ...date-AzureKeyVaultManagedStorageAccount.md | 14 +- ...e-AzureKeyVaultManagedStorageAccountKey.md | 10 +- 56 files changed, 1483 insertions(+), 614 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs index 2e9dd98cae9f..9f82d1267f0a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs @@ -101,11 +101,9 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase /// 2. pfx /// [Parameter(Mandatory = true, - Position = 2, ParameterSetName = InteractiveImportParameterSet, HelpMessage = "Path to the local file containing the key material to be imported.")] [Parameter(Mandatory = true, - Position = 2, ParameterSetName = InputObjectImportParameterSet, HelpMessage = "Path to the local file containing the key material to be imported.")] [ValidateNotNullOrEmpty] @@ -128,11 +126,9 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase /// Destination of the key /// [Parameter(Mandatory = true, - Position = 2, ParameterSetName = InteractiveCreateParameterSet, HelpMessage = "Specifies whether to add the key as a software-protected key or an HSM-protected key in the Key Vault service. Valid values are: HSM and Software. ")] [Parameter(Mandatory = true, - Position = 2, ParameterSetName = InputObjectCreateParameterSet, HelpMessage = "Specifies whether to add the key as a software-protected key or an HSM-protected key in the Key Vault service. Valid values are: HSM and Software. ")] [Parameter(Mandatory = false, diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs index 49ed22b302b9..cdb9fa52d8f7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs @@ -79,6 +79,7 @@ public class BackupAzureKeyVaultKey : KeyVaultCmdletBase ParameterSetName = ByKeyObjectParameterSet, HelpMessage = "Key bundle to back up, pipelined in from the output of a retrieval call.")] [ValidateNotNullOrEmpty] + [Alias("Key")] public PSKeyBundle InputObject { get; set; } /// diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs index 5bb012cfcc5a..190173afd950 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs @@ -79,6 +79,7 @@ public class BackupAzureKeyVaultSecret : KeyVaultCmdletBase ParameterSetName = BySecretObjectParameterSet, HelpMessage = "Secret to be backed up, pipelined in from the output of a retrieval call.")] [ValidateNotNullOrEmpty] + [Alias("Secret")] public PSSecret InputObject { get; set; } /// diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs index 354752e2f5d2..4034d7c211f7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs @@ -74,7 +74,6 @@ public class ImportAzureKeyVaultCertificate : KeyVaultCmdletBase /// File Path /// [Parameter(Mandatory = true, - Position = 2, ParameterSetName = ImportCertificateFromFileParameterSet, HelpMessage = "Specifies the path to the file that contains the certificate to add to key vault.")] public string FilePath { get; set; } @@ -83,7 +82,6 @@ public class ImportAzureKeyVaultCertificate : KeyVaultCmdletBase /// Certificate as a string /// [Parameter(Mandatory = true, - Position = 2, ParameterSetName = ImportWithPrivateKeyFromStringParameterSet, HelpMessage = "The certificate and private key to add to key vault as a string.")] public string CertificateString { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs index 3e2ae9d66757..56dfd19f1e77 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs @@ -44,7 +44,7 @@ public class RestoreAzureKeyVaultSecret : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, - ParameterSetName = ByInputObjectParameterSet, + ParameterSetName = ByVaultNameParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment." )] [ValidateNotNullOrEmpty] diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultRemoval.cs index 0284560a964e..af1a6a4625df 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultRemoval.cs @@ -12,20 +12,28 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.KeyVault.Models; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.KeyVault.Models; using System.Collections; using System.Management.Automation; -using PSKeyVaultModels = Microsoft.Azure.Commands.KeyVault.Models; namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Undo, "AzureRmKeyVaultRemoval", SupportsShouldProcess = true, + DefaultParameterSetName = DefaultParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSKeyVaultModels.PSVault))] + [OutputType(typeof(PSVault))] public class UndoAzureKeyVaultRemoval : KeyVaultManagementCmdletBase { + #region Parameter Set Names + + private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -33,11 +41,23 @@ public class UndoAzureKeyVaultRemoval : KeyVaultManagementCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } + /// + /// Vault object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Deleted vault object")] + [ValidateNotNullOrEmpty] + public PSDeletedVault InputObject { get; set; } + /// /// Resource group name /// @@ -54,6 +74,7 @@ public class UndoAzureKeyVaultRemoval : KeyVaultManagementCmdletBase /// [Parameter(Mandatory = true, Position = 2, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the deleted vault original Azure region.")] [LocationCompleter("Microsoft.KeyVault/vaults")] @@ -68,9 +89,15 @@ public class UndoAzureKeyVaultRemoval : KeyVaultManagementCmdletBase public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Location = InputObject.Location; + } + if (ShouldProcess(VaultName, Properties.Resources.RecoverVault)) { - var newVault = KeyVaultManagementClient.CreateNewVault(new PSKeyVaultModels.VaultCreationParameters() + var newVault = KeyVaultManagementClient.CreateNewVault(new VaultCreationParameters() { VaultName = this.VaultName, ResourceGroupName = this.ResourceGroupName, diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs index 6509e81780be..3c952659cb1d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs @@ -18,11 +18,19 @@ namespace Microsoft.Azure.Commands.KeyVault { [Cmdlet(VerbsCommon.Undo, "AzureKeyVaultSecretRemoval", - SupportsShouldProcess = true, - HelpUri = Constants.KeyVaultHelpUri)] + SupportsShouldProcess = true, + DefaultParameterSetName = DefaultParameterSet, + HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSSecret))] public class UndoAzureKeyVaultSecretRemoval : KeyVaultCmdletBase { + #region Parameter Set Names + + private const string DefaultParameterSet = "Default"; + private const string InputObjectParameterSet = "InputObject"; + + #endregion + #region Input Parameter Definitions /// @@ -30,6 +38,7 @@ public class UndoAzureKeyVaultSecretRemoval : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] @@ -40,16 +49,34 @@ public class UndoAzureKeyVaultSecretRemoval : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, + ParameterSetName = DefaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name.")] [ValidateNotNullOrEmpty] [Alias(Constants.SecretName)] public string Name { get; set; } + /// + /// Deleted secret object + /// + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = InputObjectParameterSet, + ValueFromPipeline = true, + HelpMessage = "Deleted secret object")] + [ValidateNotNullOrEmpty] + public PSDeletedSecret InputObject { get; set; } + #endregion public override void ExecuteCmdlet() { + if (InputObject != null) + { + VaultName = InputObject.VaultName; + Name = InputObject.Name; + } + if (ShouldProcess(Name, Properties.Resources.RecoverSecret)) { PSSecret secret = DataServiceClient.RecoverSecret(VaultName, Name); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md index 0737e1ff93e2..f70bfec4995a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 89299823-3382-402D-9458-519466748051 @@ -15,7 +15,7 @@ Adds a certificate to a key vault. ``` Add-AzureKeyVaultCertificate [-VaultName] [-Name] - [[-CertificatePolicy] ] [-Tag ] + [[-CertificatePolicy] ] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -89,14 +89,14 @@ The final command uses the Get-AzureKeyVaultCertificate cmdlet to get the certif Specifies a **KeyVaultCertificatePolicy** object. ```yaml -Type: KeyVaultCertificatePolicy +Type: PSKeyVaultCertificatePolicy Parameter Sets: (All) -Aliases: +Aliases: InputObject Required: False Position: 2 Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` @@ -153,7 +153,7 @@ Specifies the name of a key vault. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 @@ -200,7 +200,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateOperation ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md index 2734d486af6d..5a9786e8fcba 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 2D3021B3-12C5-4797-8BF2-800E3CEAC56C @@ -13,8 +13,21 @@ Adds a contact for certificate notifications. ## SYNTAX +### Interactive (Default) +``` +Add-AzureKeyVaultCertificateContact [-VaultName] [-EmailAddress] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ByObject +``` +Add-AzureKeyVaultCertificateContact [-InputObject] [-EmailAddress] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ByResourceId ``` -Add-AzureKeyVaultCertificateContact [-VaultName] [-EmailAddress] [-PassThru] +Add-AzureKeyVaultCertificateContact [-ResourceId] [-EmailAddress] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -53,9 +66,9 @@ Accept wildcard characters: False Specifies the email address of the contact. ```yaml -Type: String +Type: String[] Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 1 @@ -64,6 +77,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +KeyVault object. + +```yaml +Type: PSVault +Parameter Sets: ByObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -PassThru Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output. @@ -71,7 +99,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -80,13 +108,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ResourceId +KeyVault Resource Id. + +```yaml +Type: String +Parameter Sets: ByResourceId +Aliases: VaultId + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -VaultName Specifies the name of the key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Interactive +Aliases: Required: True Position: 0 @@ -133,7 +176,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### List +### List ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultKey.md index 9355ba06a8df..9aeb53b010ae 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultKey.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 846F781C-73A3-4BBE-ABD9-897371109FBE @@ -13,14 +13,14 @@ Creates a key in a key vault or imports a key into a key vault. ## SYNTAX -### Create (Default) +### InteractiveCreate (Default) ``` Add-AzureKeyVaultKey [-VaultName] [-Name] -Destination [-Disable] [-KeyOps ] [-Expires ] [-NotBefore ] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` -### Import +### InteractiveImport ``` Add-AzureKeyVaultKey [-VaultName] [-Name] -KeyFilePath [-KeyFilePassword ] [-Destination ] [-Disable] [-KeyOps ] @@ -28,6 +28,21 @@ Add-AzureKeyVaultKey [-VaultName] [-Name] -KeyFilePath ] ``` +### InputObjectCreate +``` +Add-AzureKeyVaultKey [-InputObject] [-Name] -Destination [-Disable] + [-KeyOps ] [-Expires ] [-NotBefore ] [-Tag ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### InputObjectImport +``` +Add-AzureKeyVaultKey [-InputObject] [-Name] -KeyFilePath + [-KeyFilePassword ] [-Destination ] [-Disable] [-KeyOps ] + [-Expires ] [-NotBefore ] [-Tag ] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Add-AzureKeyVaultKey** cmdlet creates a key in a key vault in Azure Key Vault, or imports a key into a key vault. Use this cmdlet to add keys by using any of the following methods: @@ -178,8 +193,8 @@ extension, it imports the key as a software-protected key. ```yaml Type: String -Parameter Sets: Create -Aliases: +Parameter Sets: InteractiveCreate, InputObjectCreate +Aliases: Accepted values: HSM, Software Required: True @@ -191,8 +206,8 @@ Accept wildcard characters: False ```yaml Type: String -Parameter Sets: Import -Aliases: +Parameter Sets: InteractiveImport, InputObjectImport +Aliases: Accepted values: HSM, Software Required: False @@ -209,7 +224,7 @@ the key will fail. Use this parameter if you are preloading keys that you intend ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -227,7 +242,7 @@ parameter, the key does not expire. ```yaml Type: DateTime Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -236,6 +251,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +Vault object. + +```yaml +Type: PSVault +Parameter Sets: InputObjectCreate, InputObjectImport +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -KeyFilePassword Specifies a password for the imported file as a **SecureString** object. To obtain a **SecureString** object, use the **ConvertTo-SecureString** cmdlet. For more information, type @@ -244,8 +274,8 @@ name extension. ```yaml Type: SecureString -Parameter Sets: Import -Aliases: +Parameter Sets: InteractiveImport, InputObjectImport +Aliases: Required: False Position: Named @@ -268,8 +298,8 @@ When you specify this parameter, the *Destination* parameter is optional. ```yaml Type: String -Parameter Sets: Import -Aliases: +Parameter Sets: InteractiveImport, InputObjectImport +Aliases: Required: True Position: Named @@ -295,7 +325,7 @@ the [JSON Web Key (JWK) specification](http://go.microsoft.com/fwlink/?LinkID=61 ```yaml Type: String[] Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -330,7 +360,7 @@ parameter, the key can be used immediately. ```yaml Type: DateTime Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -362,8 +392,8 @@ FQDN of a key vault based on the name that this parameter specifies and your cur ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: InteractiveCreate, InteractiveImport +Aliases: Required: True Position: 0 @@ -410,7 +440,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultManagedStorageAccount.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultManagedStorageAccount.md index e5ff37410792..b25ca7f1e7cf 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultManagedStorageAccount.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultManagedStorageAccount.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/add-azurekeyvaultmanagedstorageaccount @@ -88,7 +88,7 @@ Name of the storage account key that must be used for generating sas tokens. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 3 @@ -118,7 +118,7 @@ Disables the use of managed storage account's key for generation of sas tokens. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -135,7 +135,7 @@ storage account are not auto regenerated. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -151,7 +151,7 @@ which managed storage account's inactive keygets auto regenerated and becomes th ```yaml Type: TimeSpan Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -184,7 +184,7 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/AzureRM.KeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/AzureRM.KeyVault.md index 1b0bbcc0553a..b71a952438df 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/AzureRM.KeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/AzureRM.KeyVault.md @@ -1,4 +1,4 @@ ---- +--- Module Name: AzureRM.KeyVault Module Guid: D48CF693-4125-4D2D-8790-1514F44CE325 Download Help Link: http://go.microsoft.com/fwlink/?linkid=390762 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md index 103bb3557464..401435abfbe5 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: A82392AA-B12B-443E-8704-7CF5A9F8ED58 @@ -21,7 +21,7 @@ Backup-AzureKeyVaultKey [-VaultName] [-Name] [[-OutputFile] [[-OutputFile] ] [-Force] +Backup-AzureKeyVaultKey [-InputObject] [[-OutputFile] ] [-Force] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -85,7 +85,7 @@ Overwrite the given file if it exists ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: 3 @@ -94,13 +94,13 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -Key -Specifies a previously retrieved key which is to be backed up. +### -InputObject +Key bundle to back up, pipelined in from the output of a retrieval call. ```yaml -Type: KeyBundle +Type: PSKeyBundle Parameter Sets: ByKey -Aliases: +Aliases: Key Required: True Position: 0 @@ -132,7 +132,7 @@ If you specify the name of an existing output file, the operation will not compl ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: 2 @@ -147,7 +147,7 @@ Specifies the name of the key vault that contains the key to back up. ```yaml Type: String Parameter Sets: ByKeyName -Aliases: +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md index 8804ee1a1299..882b0d5deca9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 80AAA327-77C6-4372-9461-FFED5A15E678 @@ -21,7 +21,7 @@ Backup-AzureKeyVaultSecret [-VaultName] [-Name] [[-OutputFile] ### BySecret ``` -Backup-AzureKeyVaultSecret [-Secret] [[-OutputFile] ] [-Force] +Backup-AzureKeyVaultSecret [-InputObject] [[-OutputFile] ] [-Force] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -83,7 +83,7 @@ Prompts you for confirmation before overwriting the output file, if that exists. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: 3 @@ -92,6 +92,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +Secret to be backed up, pipelined in from the output of a retrieval call. + +```yaml +Type: PSSecret +Parameter Sets: BySecret +Aliases: Secret + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -Name Specifies the name of the secret to back up. @@ -115,7 +130,7 @@ If you specify the name of an existing output file, the operation will not compl ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: 2 @@ -124,28 +139,13 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -Secret -Specifies the object whose name and vault should be used for the backup operation. - -```yaml -Type: Secret -Parameter Sets: BySecret -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -VaultName Specifies the name of the key vault that contains the secret to back up. ```yaml Type: String Parameter Sets: BySecretName -Aliases: +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificate.md index effb248a528f..5fb855d3530b 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificate.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 363FA51E-D075-4800-A4BE-BFF63FD25C90 @@ -13,27 +13,39 @@ Gets a certificate from a key vault. ## SYNTAX -### ByVaultName (Default) +### ByName (Default) ``` -Get-AzureKeyVaultCertificate [-VaultName] [-DefaultProfile ] - [] +Get-AzureKeyVaultCertificate [-VaultName] [[-Name] ] [-InRemovedState] + [-DefaultProfile ] [] ``` -### ByCertificateName +### ByCertificateNameAndVersion ``` -Get-AzureKeyVaultCertificate [-VaultName] [-Name] [[-Version] ] +Get-AzureKeyVaultCertificate [-VaultName] [-Name] [-Version] [-DefaultProfile ] [] ``` -### ByCertificateVersions +### ByCertificateAllVersions ``` Get-AzureKeyVaultCertificate [-VaultName] [-Name] [-IncludeVersions] [-DefaultProfile ] [] ``` -### ByDeletedCertificates +### ByNameInputObject ``` -Get-AzureKeyVaultCertificate [-VaultName] [[-Name] ] [-InRemovedState] +Get-AzureKeyVaultCertificate [-InputObject] [[-Name] ] [-InRemovedState] + [-DefaultProfile ] [] +``` + +### ByCertificateNameAndVersionInputObject +``` +Get-AzureKeyVaultCertificate [-InputObject] [-Name] [-Version] + [-DefaultProfile ] [] +``` + +### ByCertificateAllVersionsInputObject +``` +Get-AzureKeyVaultCertificate [-InputObject] [-Name] [-IncludeVersions] [-DefaultProfile ] [] ``` @@ -110,8 +122,8 @@ Indicates that this operation gets all versions of the certificate. ```yaml Type: SwitchParameter -Parameter Sets: ByCertificateVersions -Aliases: +Parameter Sets: ByCertificateAllVersions, ByCertificateAllVersionsInputObject +Aliases: Required: True Position: Named @@ -120,15 +132,30 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +KeyVault object. + +```yaml +Type: PSVault +Parameter Sets: ByNameInputObject, ByCertificateNameAndVersionInputObject, ByCertificateAllVersionsInputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -InRemovedState Specifies whether to include previously deleted certificates in the output ```yaml Type: SwitchParameter -Parameter Sets: ByDeletedCertificates -Aliases: +Parameter Sets: ByName, ByNameInputObject +Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False @@ -140,10 +167,10 @@ Specifies the name of the certificate to get. ```yaml Type: String -Parameter Sets: ByCertificateName, ByCertificateVersions +Parameter Sets: ByName, ByNameInputObject Aliases: CertificateName -Required: True +Required: False Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) @@ -152,10 +179,10 @@ Accept wildcard characters: False ```yaml Type: String -Parameter Sets: ByDeletedCertificates +Parameter Sets: ByCertificateNameAndVersion, ByCertificateAllVersions, ByCertificateNameAndVersionInputObject, ByCertificateAllVersionsInputObject Aliases: CertificateName -Required: False +Required: True Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) @@ -167,8 +194,8 @@ Specifies the name of a key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByName, ByCertificateNameAndVersion, ByCertificateAllVersions +Aliases: Required: True Position: 0 @@ -182,10 +209,10 @@ Specifies the version of a certificate. ```yaml Type: String -Parameter Sets: ByCertificateName +Parameter Sets: ByCertificateNameAndVersion, ByCertificateNameAndVersionInputObject Aliases: CertificateVersion -Required: False +Required: True Position: 2 Default value: None Accept pipeline input: True (ByPropertyName) @@ -199,9 +226,9 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.CertificateIdentityItem] +### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSCertificateIdentityItem] -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificate +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificate ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateContact.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateContact.md index e84a6632e360..9cddda225bdd 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateContact.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateContact.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 200C68A3-A79C-4517-8E5D-8128F6C73A5C @@ -13,11 +13,24 @@ Gets contacts that are registered for certificate notifications for a key vault. ## SYNTAX +### VaultName (Default) ``` Get-AzureKeyVaultCertificateContact [-VaultName] [-DefaultProfile ] [] ``` +### ByInputObject +``` +Get-AzureKeyVaultCertificateContact [-InputObject] [-DefaultProfile ] + [] +``` + +### ByResourceId +``` +Get-AzureKeyVaultCertificateContact [-ResourceId] [-DefaultProfile ] + [] +``` + ## DESCRIPTION The **Get-AzureKeyVaultCertificateContact** cmdlet gets contacts that are registered for certificate notifications for a key vault in Azure Key Vault. @@ -47,13 +60,43 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +KeyVault object. + +```yaml +Type: PSVault +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceId +KeyVault Id. + +```yaml +Type: String +Parameter Sets: ByResourceId +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -VaultName Specifies the name of the key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: VaultName +Aliases: Required: True Position: 0 @@ -69,7 +112,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### List +### List ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateIssuer.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateIssuer.md index 95d4675bd1dc..c4bef63f770b 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateIssuer.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateIssuer.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 5F856280-C561-47B5-AA96-27E34C86D604 @@ -13,15 +13,15 @@ Gets a certificate issuer for a key vault. ## SYNTAX -### ByVaultName (Default) +### ByName (Default) ``` -Get-AzureKeyVaultCertificateIssuer [-VaultName] [-DefaultProfile ] - [] +Get-AzureKeyVaultCertificateIssuer [-VaultName] [[-Name] ] + [-DefaultProfile ] [] ``` -### ByName +### ByInputObject ``` -Get-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] +Get-AzureKeyVaultCertificateIssuer [-InputObject] [[-Name] ] [-DefaultProfile ] [] ``` @@ -59,15 +59,30 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +KeyVault object. + +```yaml +Type: PSVault +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of the certificate issuer to get. ```yaml Type: String -Parameter Sets: ByName +Parameter Sets: (All) Aliases: IssuerName -Required: True +Required: False Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) @@ -79,8 +94,8 @@ Specifies the name of a key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByName +Aliases: Required: True Position: 0 @@ -96,7 +111,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### List, Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateIssuer +### List, Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateIssuer ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateOperation.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateOperation.md index c7cbcf49fc1f..28a62f8dbfac 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateOperation.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateOperation.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 0743C43D-2A1F-4950-B0F3-1FED4014EEC5 @@ -13,11 +13,18 @@ Gets the status of a certificate operation. ## SYNTAX +### ByName (Default) ``` Get-AzureKeyVaultCertificateOperation [-VaultName] [-Name] [-DefaultProfile ] [] ``` +### ByInputObject +``` +Get-AzureKeyVaultCertificateOperation [-InputObject] + [-DefaultProfile ] [] +``` + ## DESCRIPTION The **Get-AzureKeyVaultCertificateOperation** cmdlet gets the status of a certificate operation. @@ -57,12 +64,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Certificate Object. + +```yaml +Type: PSKeyVaultCertificate +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of a certificate. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: ByName Aliases: CertificateName Required: True @@ -77,8 +99,8 @@ Specifies the name of a key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByName +Aliases: Required: True Position: 0 @@ -94,7 +116,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateOperation ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificatePolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificatePolicy.md index a16ee7dc3e69..773f0512c055 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificatePolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificatePolicy.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 0729687C-3104-4136-A80D-16BAEBD6B76C @@ -13,11 +13,18 @@ Gets the policy for a certificate in a key vault. ## SYNTAX +### VaultAndCertName (Default) ``` Get-AzureKeyVaultCertificatePolicy [-VaultName] [-Name] [-DefaultProfile ] [] ``` +### InputObject +``` +Get-AzureKeyVaultCertificatePolicy [-InputObject] + [-DefaultProfile ] [] +``` + ## DESCRIPTION The **Get-AzureKeyVaultCertificatePolicy** cmdlet gets the policy for a certificate in a key vault in Azure Key Vault. @@ -63,12 +70,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Certificate Object. + +```yaml +Type: PSKeyVaultCertificate +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of a certificate. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: VaultAndCertName Aliases: CertificateName Required: True @@ -83,8 +105,8 @@ Specifies the name of a key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: VaultAndCertName +Aliases: Required: True Position: 0 @@ -100,7 +122,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificatePolicy ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultKey.md index c64780d05da8..ebfe0303fa31 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultKey.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 2BE34AE1-06FA-4F66-8FDB-CED22C2E0978 @@ -15,12 +15,13 @@ Gets Key Vault keys. ### ByVaultName (Default) ``` -Get-AzureKeyVaultKey [-VaultName] [-DefaultProfile ] [] +Get-AzureKeyVaultKey [-VaultName] [[-Name] ] [-InRemovedState] + [-DefaultProfile ] [] ``` ### ByKeyName ``` -Get-AzureKeyVaultKey [-VaultName] [-Name] [[-Version] ] +Get-AzureKeyVaultKey [-VaultName] [-Name] [-Version] [-DefaultProfile ] [] ``` @@ -30,9 +31,21 @@ Get-AzureKeyVaultKey [-VaultName] [-Name] [-IncludeVersions] [-DefaultProfile ] [] ``` -### ByDeletedKey +### ByInputObjectVaultName ``` -Get-AzureKeyVaultKey [-VaultName] [[-Name] ] [-InRemovedState] +Get-AzureKeyVaultKey [-InputObject] [[-Name] ] [-InRemovedState] + [-DefaultProfile ] [] +``` + +### ByInputObjectKeyName +``` +Get-AzureKeyVaultKey [-InputObject] [-Name] [-Version] + [-DefaultProfile ] [] +``` + +### ByKInputObjecteyVersions +``` +Get-AzureKeyVaultKey [-InputObject] [-Name] [-IncludeVersions] [-DefaultProfile ] [] ``` @@ -112,8 +125,8 @@ If you do not specify the *IncludeVersions* parameter, this cmdlet gets the curr ```yaml Type: SwitchParameter -Parameter Sets: ByKeyVersions -Aliases: +Parameter Sets: ByKeyVersions, ByKInputObjecteyVersions +Aliases: Required: True Position: Named @@ -122,15 +135,30 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +KeyVault object. + +```yaml +Type: PSVault +Parameter Sets: ByInputObjectVaultName, ByInputObjectKeyName, ByKInputObjecteyVersions +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -InRemovedState Specifies whether to show the previously deleted keys in the output ```yaml Type: SwitchParameter -Parameter Sets: ByDeletedKey -Aliases: +Parameter Sets: ByVaultName, ByInputObjectVaultName +Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False @@ -142,10 +170,10 @@ Specifies the name of the key bundle to get. ```yaml Type: String -Parameter Sets: ByKeyName, ByKeyVersions +Parameter Sets: ByVaultName, ByInputObjectVaultName Aliases: KeyName -Required: True +Required: False Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) @@ -154,10 +182,10 @@ Accept wildcard characters: False ```yaml Type: String -Parameter Sets: ByDeletedKey +Parameter Sets: ByKeyName, ByKeyVersions, ByInputObjectKeyName, ByKInputObjecteyVersions Aliases: KeyName -Required: False +Required: True Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) @@ -170,8 +198,8 @@ This cmdlet constructs the fully qualified domain name (FQDN) of a key vault bas ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByVaultName, ByKeyName, ByKeyVersions +Aliases: Required: True Position: 0 @@ -186,10 +214,10 @@ This cmdlet constructs the FQDN of a key based on the key vault name, your curre ```yaml Type: String -Parameter Sets: ByKeyName +Parameter Sets: ByKeyName, ByInputObjectKeyName Aliases: KeyVersion -Required: False +Required: True Position: 2 Default value: None Accept pipeline input: True (ByPropertyName) @@ -205,7 +233,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### List, Microsoft.Azure.Commands.KeyVault.Models.KeyBundle, List, Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyBundle +### List, Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle, List, Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyBundle ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultManagedStorageAccount.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultManagedStorageAccount.md index abe715205a88..d3d963f61276 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultManagedStorageAccount.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultManagedStorageAccount.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/get-azurekeyvaultmanagedstorageaccount @@ -82,7 +82,7 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultManagedStorageSasDefinition.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultManagedStorageSasDefinition.md index 2d9f2a0a8e73..0d6e9a4662af 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultManagedStorageSasDefinition.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultManagedStorageSasDefinition.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/get-azurekeyvaultmanagedstoragesasdefinition @@ -99,7 +99,7 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultSecret.md index a526596031d6..3ee30251d8c3 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultSecret.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 8C9B33EE-10DE-4803-B76D-FE9FC2AC3372 @@ -15,12 +15,13 @@ Gets the secrets in a key vault. ### ByVaultName (Default) ``` -Get-AzureKeyVaultSecret [-VaultName] [-DefaultProfile ] [] +Get-AzureKeyVaultSecret [-VaultName] [[-Name] ] [-InRemovedState] + [-DefaultProfile ] [] ``` ### BySecretName ``` -Get-AzureKeyVaultSecret [-VaultName] [-Name] [[-Version] ] +Get-AzureKeyVaultSecret [-VaultName] [-Name] [-Version] [-DefaultProfile ] [] ``` @@ -30,9 +31,21 @@ Get-AzureKeyVaultSecret [-VaultName] [-Name] [-IncludeVersions [-DefaultProfile ] [] ``` -### ByDeletedSecrets +### ByInputObjectVaultName ``` -Get-AzureKeyVaultSecret [-VaultName] [[-Name] ] [-InRemovedState] +Get-AzureKeyVaultSecret [-InputObject] [[-Name] ] [-InRemovedState] + [-DefaultProfile ] [] +``` + +### ByInputObjectSecretName +``` +Get-AzureKeyVaultSecret [-InputObject] [-Name] [-Version] + [-DefaultProfile ] [] +``` + +### ByInputObjectSecretVersions +``` +Get-AzureKeyVaultSecret [-InputObject] [-Name] [-IncludeVersions] [-DefaultProfile ] [] ``` @@ -119,8 +132,8 @@ If you do not specify the *IncludeVersions* parameter, this cmdlet gets the curr ```yaml Type: SwitchParameter -Parameter Sets: BySecretVersions -Aliases: +Parameter Sets: BySecretVersions, ByInputObjectSecretVersions +Aliases: Required: True Position: Named @@ -129,15 +142,30 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +KeyVault Object. + +```yaml +Type: PSVault +Parameter Sets: ByInputObjectVaultName, ByInputObjectSecretName, ByInputObjectSecretVersions +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -InRemovedState Specifies whether to show the previously deleted secrets in the output ```yaml Type: SwitchParameter -Parameter Sets: ByDeletedSecrets -Aliases: +Parameter Sets: ByVaultName, ByInputObjectVaultName +Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False @@ -149,10 +177,10 @@ Specifies the name of the secret to get. ```yaml Type: String -Parameter Sets: BySecretName, BySecretVersions +Parameter Sets: ByVaultName, ByInputObjectVaultName Aliases: SecretName -Required: True +Required: False Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) @@ -161,10 +189,10 @@ Accept wildcard characters: False ```yaml Type: String -Parameter Sets: ByDeletedSecrets +Parameter Sets: BySecretName, BySecretVersions, ByInputObjectSecretName, ByInputObjectSecretVersions Aliases: SecretName -Required: False +Required: True Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) @@ -177,8 +205,8 @@ This cmdlet constructs the fully qualified domain name (FQDN) of a key vault bas ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByVaultName, BySecretName, BySecretVersions +Aliases: Required: True Position: 0 @@ -193,10 +221,10 @@ This cmdlet constructs the FQDN of a secret based on the key vault name, your cu ```yaml Type: String -Parameter Sets: BySecretName +Parameter Sets: BySecretName, ByInputObjectSecretName Aliases: SecretVersion -Required: False +Required: True Position: 2 Default value: None Accept pipeline input: True (ByPropertyName) @@ -212,7 +240,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### List, Microsoft.Azure.Commands.KeyVault.Models.Secret, List, Microsoft.Azure.Commands.KeyVault.Models.DeletedSecret +### List, Microsoft.Azure.Commands.KeyVault.Models.PSSecret, List, Microsoft.Azure.Commands.KeyVault.Models.PSDeletedSecret ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md index 3bbde354402b..7c480e13ffe6 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: A7C287C4-E9FD-407A-91BD-EFA17C33FC8B @@ -13,6 +13,11 @@ Gets key vaults. ## SYNTAX +### ListAllVaultsInSubscription (Default) +``` +Get-AzureRmKeyVault [-Tag ] [-DefaultProfile ] [] +``` + ### GetVaultByName ``` Get-AzureRmKeyVault [-VaultName] [[-ResourceGroupName] ] @@ -36,11 +41,6 @@ Get-AzureRmKeyVault [-ResourceGroupName] [-DefaultProfile ] [] ``` -### ListAllVaultsInSubscription -``` -Get-AzureRmKeyVault [-Tag ] [-DefaultProfile ] [] -``` - ## DESCRIPTION The **Get-AzureRmKeyVault** cmdlet gets information about the key vaults in a subscription. You can view all key vaults instances in a subscription, or filter your results by a resource group or a @@ -112,7 +112,7 @@ Specifies whether to show the previously deleted vaults in the output. ```yaml Type: SwitchParameter Parameter Sets: ByDeletedVault, ListAllDeletedVaultsInSubscription -Aliases: +Aliases: Required: True Position: Named @@ -127,10 +127,10 @@ The location of the deleted vault. ```yaml Type: String Parameter Sets: ByDeletedVault -Aliases: +Aliases: Required: True -Position: 2 +Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -142,7 +142,7 @@ Specifies the name of the resource group associated with the key vault or key va ```yaml Type: String Parameter Sets: GetVaultByName -Aliases: +Aliases: Required: False Position: 1 @@ -154,7 +154,7 @@ Accept wildcard characters: False ```yaml Type: String Parameter Sets: ListVaultsByResourceGroup -Aliases: +Aliases: Required: True Position: 1 @@ -171,7 +171,7 @@ Key-value pairs in the form of a hash table. For example: ```yaml Type: Hashtable Parameter Sets: ListAllVaultsInSubscription -Aliases: +Aliases: Required: False Position: Named diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md index 2dad5b2a6aeb..ac83995f65b6 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: D4188DC6-A8AB-4B45-9781-94B74C338C63 @@ -15,12 +15,6 @@ Imports a certificate to a key vault. ### ImportCertificateFromFile (Default) ``` -Import-AzureKeyVaultCertificate [-VaultName] [-Name] -FilePath [-Tag ] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] -``` - -### ImportWithPrivateKeyFromFile -``` Import-AzureKeyVaultCertificate [-VaultName] [-Name] -FilePath [-Password ] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] @@ -36,7 +30,7 @@ Import-AzureKeyVaultCertificate [-VaultName] [-Name] -Certific ### ImportWithPrivateKeyFromCollection ``` Import-AzureKeyVaultCertificate [-VaultName] [-Name] - -CertificateCollection [-Tag ] + [-CertificateCollection] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -93,12 +87,12 @@ Specifies the certificate collection to add to a key vault. ```yaml Type: X509Certificate2Collection Parameter Sets: ImportWithPrivateKeyFromCollection -Aliases: +Aliases: InputObject Required: True -Position: Named +Position: 2 Default value: None -Accept pipeline input: False +Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` @@ -108,7 +102,7 @@ Specifies a certificate string. ```yaml Type: String Parameter Sets: ImportWithPrivateKeyFromString -Aliases: +Aliases: Required: True Position: Named @@ -137,8 +131,8 @@ Specifies the path of the certificate file that this cmdlet imports. ```yaml Type: String -Parameter Sets: ImportCertificateFromFile, ImportWithPrivateKeyFromFile -Aliases: +Parameter Sets: ImportCertificateFromFile +Aliases: Required: True Position: Named @@ -168,8 +162,8 @@ Specifies the password for a certificate file. ```yaml Type: SecureString -Parameter Sets: ImportWithPrivateKeyFromFile, ImportWithPrivateKeyFromString -Aliases: +Parameter Sets: ImportCertificateFromFile, ImportWithPrivateKeyFromString +Aliases: Required: False Position: Named @@ -186,7 +180,7 @@ Key-value pairs in the form of a hash table. For example: ```yaml Type: Hashtable Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -202,7 +196,7 @@ This cmdlet constructs the fully qualified domain name (FQDN) of a key vault bas ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 @@ -249,7 +243,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.CertificateBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSCertificateBundle ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateAdministratorDetails.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateAdministratorDetails.md index e1526d2daf64..e9a22dece50d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateAdministratorDetails.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateAdministratorDetails.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 775AB0E8-EC3C-4F96-8AF8-51C1DFEEF082 @@ -54,7 +54,7 @@ Specifies the email address for the certificate administrator. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -69,7 +69,7 @@ Specifies the first name of the certificate administrator. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -84,7 +84,7 @@ Specifies the last name of the certificate administrator. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -99,7 +99,7 @@ Specifies the phone number of the certificate administrator. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -146,7 +146,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateAdministratorDetails ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateOrganizationDetails.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateOrganizationDetails.md index 14c4f9221c41..17360bc450ca 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateOrganizationDetails.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateOrganizationDetails.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 0E1C05B0-8CF6-4C03-AA05-B13A4059A280 @@ -15,7 +15,7 @@ Creates an in-memory certificate organization details object. ``` New-AzureKeyVaultCertificateOrganizationDetails [-Id ] - [-AdministratorDetails ] + [-AdministratorDetails ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -40,14 +40,14 @@ The second command creates a certificate organization details object, and then s Specifies the certificate organization administrators. ```yaml -Type: System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails] +Type: System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateAdministratorDetails] Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` @@ -72,7 +72,7 @@ Specifies the identifier for the organization. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -119,7 +119,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOrganizationDetails +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateOrganizationDetails ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md index 0fff58c51b7b..bd5473e518bb 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 25E0F0E9-BF8C-49DF-87BA-31E2103A29A9 @@ -13,14 +13,50 @@ Creates an in-memory certificate policy object. ## SYNTAX +### SubjectNameWithRenewDays (Default) +``` +New-AzureKeyVaultCertificatePolicy [-IssuerName] [-SubjectName] + [-RenewAtNumberOfDaysBeforeExpiry ] [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] + [-KeyUsage ] + [-Ekus ] [-ValidityInMonths ] + [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] + [-KeyType ] [-KeyNotExportable] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +### SubjectNameWithRenewPercent +``` +New-AzureKeyVaultCertificatePolicy [-IssuerName] [-SubjectName] + -RenewAtPercentageLifetime [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] + [-KeyUsage ] + [-Ekus ] [-ValidityInMonths ] + [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] + [-KeyType ] [-KeyNotExportable] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +### DNSNamesWithRenewDays ``` -New-AzureKeyVaultCertificatePolicy [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] - [-SubjectName ] [-DnsNames ] +New-AzureKeyVaultCertificatePolicy [-IssuerName] [[-SubjectName] ] + [-DnsNames] [-RenewAtNumberOfDaysBeforeExpiry ] + [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] [-KeyUsage ] - [-Ekus ] [-ValidityInMonths ] -IssuerName - [-CertificateType ] [-RenewAtNumberOfDaysBeforeExpiry ] [-RenewAtPercentageLifetime ] - [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] [-KeyType ] - [-KeyNotExportable] [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-Ekus ] [-ValidityInMonths ] + [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] + [-KeyType ] [-KeyNotExportable] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +### DNSNamesWithRenewPercent +``` +New-AzureKeyVaultCertificatePolicy [-IssuerName] [[-SubjectName] ] + [-DnsNames] -RenewAtPercentageLifetime + [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] + [-KeyUsage ] + [-Ekus ] [-ValidityInMonths ] + [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] + [-KeyType ] [-KeyNotExportable] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -43,7 +79,7 @@ Specifies the type of certificate to the issuer. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -73,7 +109,7 @@ Indicates that the certificate policy is disabled. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -87,11 +123,11 @@ Specifies the DNS names in the certificate. ```yaml Type: System.Collections.Generic.List`1[System.String] -Parameter Sets: (All) -Aliases: +Parameter Sets: DNSNamesWithRenewDays, DNSNamesWithRenewPercent +Aliases: -Required: False -Position: Named +Required: True +Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -103,7 +139,7 @@ Specifies the enhanced key usages (EKUs) in the certificate. ```yaml Type: System.Collections.Generic.List`1[System.String] Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -118,7 +154,7 @@ Specifies how many days before expiry the automatic notification process begins. ```yaml Type: Int32 Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -133,7 +169,7 @@ Specifies the percentage of the lifetime after which the automatic process for t ```yaml Type: Int32 Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -148,10 +184,10 @@ Specifies the name of the issuer for the certificate. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True -Position: Named +Position: 0 Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -163,7 +199,7 @@ Indicates that the key is not exportable. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -182,7 +218,7 @@ The acceptable values for this parameter are: ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Accepted values: RSA, RSA-HSM Required: False @@ -198,7 +234,7 @@ Specifies the key usages in the certificate. ```yaml Type: System.Collections.Generic.List`1[System.String] Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -212,8 +248,8 @@ Specifies the number of days before expiry after which the automatic process for ```yaml Type: Int32 -Parameter Sets: (All) -Aliases: +Parameter Sets: SubjectNameWithRenewDays, DNSNamesWithRenewDays +Aliases: Required: False Position: Named @@ -227,10 +263,10 @@ Specifies the percentage of the lifetime after which the automatic process for c ```yaml Type: Int32 -Parameter Sets: (All) -Aliases: +Parameter Sets: SubjectNameWithRenewPercent, DNSNamesWithRenewPercent +Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) @@ -243,7 +279,7 @@ Indicates that the certificate reuse the key during renewal. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -262,7 +298,7 @@ The acceptable values for this parameter are: ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Accepted values: application/x-pkcs12, application/x-pem-file Required: False @@ -277,11 +313,23 @@ Specifies the subject name of the certificate. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: SubjectNameWithRenewDays, SubjectNameWithRenewPercent +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: DNSNamesWithRenewDays, DNSNamesWithRenewPercent +Aliases: Required: False -Position: Named +Position: 1 Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False @@ -293,7 +341,7 @@ Specifies the number of months the certificate is valid. ```yaml Type: Int32 Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -340,7 +388,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificatePolicy ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md index dda45eed1f38..5f842c97fdeb 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 4C40DAC9-5C0B-4AFD-9BDB-D407E0B9F701 @@ -14,10 +14,9 @@ Creates a key vault. ## SYNTAX ``` -New-AzureRmKeyVault [-VaultName] [-ResourceGroupName] [-Location] - [-EnabledForDeployment] [-EnabledForTemplateDeployment] [-EnabledForDiskEncryption] [-EnableSoftDelete] - [-Sku ] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] +New-AzureRmKeyVault [-Name] [-ResourceGroupName] [-Location] [-EnabledForDeployment] + [-EnabledForTemplateDeployment] [-EnabledForDiskEncryption] [-EnableSoftDelete] [-Sku ] + [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -73,7 +72,7 @@ key vault is referenced in resource creation, for example when creating a virtua ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -88,7 +87,7 @@ Enables the Azure disk encryption service to get secrets and unwrap keys from th ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -103,7 +102,7 @@ Enables Azure Resource Manager to get secrets from this key vault when this key ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -120,7 +119,7 @@ For more information about this functionality, see [Azure Key Vault soft-delete ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -135,7 +134,7 @@ Specifies the Azure region in which to create the key vault. Use the command [Ge ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 2 @@ -144,13 +143,26 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -Name +Specifies a name of the key vault to create. The name can be any combination of letters, digits, or hyphens. The name must start and end with a letter or digit. The name must be universally unique.```yaml +Type: String +Parameter Sets: (All) +Aliases: VaultName + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -ResourceGroupName Specifies the name of an existing resource group in which to create the key vault. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 1 @@ -165,7 +177,7 @@ Specifies the SKU of the key vault instance. For information about which feature ```yaml Type: SkuName Parameter Sets: (All) -Aliases: +Aliases: Accepted values: Standard, Premium Required: False @@ -192,23 +204,6 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -VaultName -Specifies the name of the key vault to create. The name can be any combination of letters, digits, -or hyphens. The name must start and end with a letter or digit. The name must be universally -unique. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -Confirm Prompts you for confirmation before running the cmdlet. diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificate.md index 4345cf8d6149..fce4b90df66c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificate.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 34985F06-4D8D-463B-B113-972666D18485 @@ -13,8 +13,15 @@ Removes a certificate from a key vault. ## SYNTAX +### ByVaultNameAndName (Default) +``` +Remove-AzureKeyVaultCertificate [-VaultName] [-Name] [-InRemovedState] [-Force] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ByObject ``` -Remove-AzureKeyVaultCertificate [-VaultName] [-Name] [-Force] [-InRemovedState] [-PassThru] +Remove-AzureKeyVaultCertificate [-InputObject] [-InRemovedState] [-Force] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -70,7 +77,7 @@ Forces the command to run without asking for user confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -79,13 +86,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Certificate Object. + +```yaml +Type: PSKeyVaultCertificate +Parameter Sets: ByObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -InRemovedState If present, removes the previously deleted certificate permanently ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -100,8 +122,8 @@ This cmdlet constructs the fully qualified domain name (FQDN) of a certificate b ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByVaultNameAndName +Aliases: Required: True Position: 1 @@ -117,7 +139,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -132,8 +154,8 @@ This cmdlet constructs the FQDN of a key vault based on the name that this param ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByVaultNameAndName +Aliases: Required: True Position: 0 @@ -181,7 +203,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.CertificateBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSCertificateBundle ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateContact.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateContact.md index 762f0c0c4bd4..293b4d460921 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateContact.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateContact.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 35FAA57F-B2BD-4E43-8238-12F7A8269E4D @@ -14,7 +14,7 @@ Deletes a contact that is registered for certificate notifications from a key va ## SYNTAX ``` -Remove-AzureKeyVaultCertificateContact [-VaultName] [-EmailAddress] [-PassThru] +Remove-AzureKeyVaultCertificateContact [-VaultName] [-EmailAddress] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -51,9 +51,9 @@ Accept wildcard characters: False Specifies the email address of the contact to remove. ```yaml -Type: String +Type: String[] Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 1 @@ -69,7 +69,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -84,7 +84,7 @@ Specifies the name of a key vault. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 @@ -131,7 +131,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateContact] +### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateContact] ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateIssuer.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateIssuer.md index 65fe0e44dab2..f25b970cc9d4 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateIssuer.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateIssuer.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: FC14F6BF-BD8F-45E0-9CAA-A937E5E56288 @@ -13,11 +13,18 @@ Deletes a certificate issuer from a key vault. ## SYNTAX +### Default (Default) ``` Remove-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] [-Force] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Remove-AzureKeyVaultCertificateIssuer [-InputObject] [-Force] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Remove-AzureKeyVaultCertificateIssuer** cmdlet deletes a certificate issuer from a key vault. @@ -53,7 +60,7 @@ Forces the command to run without asking for user confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -62,12 +69,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Certificate Issuer Object + +```yaml +Type: PSKeyVaultCertificateIssuer +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of the issuer to remove. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Default Aliases: IssuerName Required: True @@ -84,7 +106,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -98,8 +120,8 @@ Specifies the name of a key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 @@ -147,7 +169,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateIssuer +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateIssuer ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateOperation.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateOperation.md index f4a40426e9e6..dcee16b64bb7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateOperation.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateOperation.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 2659C06A-AE5B-4F7B-B9EF-069A74E12560 @@ -13,11 +13,18 @@ Deletes a certificate operation from a key vault. ## SYNTAX +### Default ``` Remove-AzureKeyVaultCertificateOperation [-VaultName] [-Name] [-Force] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Remove-AzureKeyVaultCertificateOperation [-InputObject] [-Force] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Remove-AzureKeyVaultCertificateOperation** cmdlet deletes a certificate operation from a key vault. @@ -53,7 +60,7 @@ Forces the command to run without asking for user confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -62,12 +69,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Operation object + +```yaml +Type: PSKeyVaultCertificateOperation +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of a certificate. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Default Aliases: CertificateName Required: True @@ -84,7 +106,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -98,8 +120,8 @@ Specifies the name of a key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 @@ -147,7 +169,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateOperation ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultKey.md index 9afddf9a52e7..845e792cc7e2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultKey.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 817BF177-519F-47BA-86CF-4591FB402E2Dl @@ -13,11 +13,18 @@ Deletes a key in a key vault. ## SYNTAX +### ByVaultName (Default) ``` Remove-AzureKeyVaultKey [-VaultName] [-Name] [-Force] [-PassThru] [-InRemovedState] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### ByInputObject +``` +Remove-AzureKeyVaultKey [-InputObject] [-Force] [-PassThru] [-InRemovedState] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The Remove-AzureKeyVaultKey cmdlet deletes a key in a key vault. If the key was accidentally deleted the key can be recovered using Undo-AzureKeyVaultKeyRemoval by a user with special 'recover' permissions. @@ -80,7 +87,7 @@ Forces the command to run without asking for user confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -89,13 +96,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +KeyBundle Object + +```yaml +Type: PSKeyBundle +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -InRemovedState Remove the previously deleted key permanently. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -110,7 +132,7 @@ This cmdlet constructs the fully qualified domain name (FQDN) of a key based on ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: ByVaultName Aliases: KeyName Required: True @@ -127,7 +149,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -142,8 +164,8 @@ This cmdlet constructs the FQDN of a key vault based on the name that this param ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByVaultName +Aliases: Required: True Position: 0 @@ -193,7 +215,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyBundle This cmdlet returns a value only if you specify the *PassThru* parameter. ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultManagedStorageAccount.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultManagedStorageAccount.md index 69c4b4bb5650..38072c342dc7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultManagedStorageAccount.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultManagedStorageAccount.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/remove-azurekeyvaultmanagedstorageaccount @@ -74,7 +74,7 @@ Do not ask for confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -90,7 +90,7 @@ If this switch is specified, cmdlet returns the managed storage account that was ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -106,7 +106,7 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultManagedStorageSasDefinition.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultManagedStorageSasDefinition.md index 232bbf416b8c..b685ddc8d3c7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultManagedStorageSasDefinition.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultManagedStorageSasDefinition.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/remove-azurekeyvaultmanagedstoragesasdefinition @@ -75,7 +75,7 @@ Do not ask for confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -107,7 +107,7 @@ If this switch is specified, cmdlet returns the managed storage account that was ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -123,7 +123,7 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultSecret.md index 7fd61724bc84..94d37eed77b8 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultSecret.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/remove-azurekeyvaultsecret @@ -12,11 +12,18 @@ Deletes a secret in a key vault. ## SYNTAX +### ByVaultName (Default) ``` Remove-AzureKeyVaultSecret [-VaultName] [-Name] [-Force] [-PassThru] [-InRemovedState] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### ByInputObject +``` +Remove-AzureKeyVaultSecret [-InputObject] [-Force] [-PassThru] [-InRemovedState] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The Remove-AzureKeyVaultSecret cmdlet deletes a secret in a key vault. If the secret was accidentally deleted the secret can be recovered using Undo-AzureKeyVaultSecretRemoval by a user with special 'recover' permissions. @@ -70,7 +77,7 @@ Forces the command to run without asking for user confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -79,13 +86,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Key Vault Secret Object + +```yaml +Type: PSSecret +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -InRemovedState If present, removes the previously deleted secret permanently. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -100,7 +122,7 @@ This cmdlet constructs the fully qualified domain name (FQDN) of a secret based ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: ByVaultName Aliases: SecretName Required: True @@ -117,7 +139,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -132,8 +154,8 @@ This cmdlet constructs the FQDN of a key vault based on the name that this param ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByVaultName +Aliases: Required: True Position: 0 @@ -183,7 +205,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.DeletedSecret +### Microsoft.Azure.Commands.KeyVault.Models.PSDeletedSecret This cmdlet returns a value only if you specify the *PassThru* parameter. ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md index 95409e7a22aa..d3b3fbc0ecae 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md @@ -13,7 +13,7 @@ Deletes a key vault. ## SYNTAX -### ByAvailableVault +### ByAvailableVault (Default) ``` Remove-AzureRmKeyVault [-VaultName] [[-ResourceGroupName] ] [[-Location] ] [-Force] [-AsJob] [-DefaultProfile ] [-WhatIf] [-Confirm] [] @@ -21,7 +21,19 @@ Remove-AzureRmKeyVault [-VaultName] [[-ResourceGroupName] ] [[- ### ByDeletedVault ``` -Remove-AzureRmKeyVault [-VaultName] [-Location] [-Force] [-InRemovedState] [-AsJob] +Remove-AzureRmKeyVault [-VaultName] [-Location] [-InRemovedState] [-Force] [-AsJob] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### InputObjectByAvailableVault +``` +Remove-AzureRmKeyVault [-InputObject] [[-Location] ] [-Force] [-AsJob] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### InputObjectByDeletedVault +``` +Remove-AzureRmKeyVault [-InputObject] [-Location] [-InRemovedState] [-Force] [-AsJob] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -96,15 +108,30 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Key Vault object to be deleted. + +```yaml +Type: PSVault +Parameter Sets: InputObjectByAvailableVault, InputObjectByDeletedVault +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -InRemovedState Remove the previously deleted vault permanently. ```yaml Type: SwitchParameter -Parameter Sets: ByDeletedVault +Parameter Sets: ByDeletedVault, InputObjectByDeletedVault Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: False @@ -116,7 +143,7 @@ The location of the deleted vault. ```yaml Type: String -Parameter Sets: ByAvailableVault +Parameter Sets: ByAvailableVault, InputObjectByAvailableVault Aliases: Required: False @@ -128,7 +155,7 @@ Accept wildcard characters: False ```yaml Type: String -Parameter Sets: ByDeletedVault +Parameter Sets: ByDeletedVault, InputObjectByDeletedVault Aliases: Required: True @@ -158,7 +185,7 @@ Specifies the name of the key vault to remove. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: ByAvailableVault, ByDeletedVault Aliases: Required: True diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md index 85ce4252d126..a82d2d75042a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: AE7B103B-23ED-4A66-A0DC-14FB0DF38FA8 @@ -13,14 +13,7 @@ Removes all permissions for a user or application from a key vault. ## SYNTAX -### ByServicePrincipalName -``` -Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] - -ServicePrincipalName [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] -``` - -### ByUserPrincipalName +### ByUserPrincipalName (Default) ``` Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] -UserPrincipalName [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] @@ -34,6 +27,13 @@ Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] < [] ``` +### ByServicePrincipalName +``` +Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] + -ServicePrincipalName [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + ### ByEmail ``` Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] -EmailAddress @@ -42,11 +42,42 @@ Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] < ### ForVault ``` -Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] - [-EnabledForDeployment] [-EnabledForTemplateDeployment] [-EnabledForDiskEncryption] [-PassThru] +Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] [-DisableDeployment] + [-DisableTemplateDeployment] [-DisableDiskEncryption] [-PassThru] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] +``` + +### InputObjectByObjectId +``` +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -ObjectId [-ApplicationId ] + [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### InputObjectByServicePrincipalName +``` +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -ServicePrincipalName [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### InputObjectByUserPrincipalName +``` +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -UserPrincipalName [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### InputObjectByEmail +``` +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -EmailAddress [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObjectForVault +``` +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] [-DisableDeployment] [-DisableTemplateDeployment] + [-DisableDiskEncryption] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + ## DESCRIPTION The **Remove-AzureRmKeyVaultAccessPolicy** cmdlet removes all permissions for a user or application or for all users and applications from a key vault. Even if you remove all permissions, the owner of the Azure subscription that contains the key vault can add permissions to the key vault. @@ -92,8 +123,8 @@ For future use. ```yaml Type: Guid -Parameter Sets: ByObjectId -Aliases: +Parameter Sets: ByObjectId, InputObjectByObjectId +Aliases: Required: False Position: Named @@ -117,28 +148,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -EmailAddress -Specifies the user email address of the user whose access you want to remove. +### -DisableDeployment +If specified, disables the retrieval of secrets from this key vault by the Microsoft.Compute resource provider when referenced in resource creation. ```yaml -Type: String -Parameter Sets: ByEmail -Aliases: +Type: SwitchParameter +Parameter Sets: ForVault, InputObjectForVault +Aliases: EnabledForDeployment -Required: True +Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -EnabledForDeployment -Enables the Microsoft.Compute resource provider to retrieve secrets from this key vault when this key vault is referenced in resource creation, for example when creating a virtual machine. +### -DisableDiskEncryption +If specified, disables the retrieval of secrets from this key vault by Azure Disk Encryption. ```yaml Type: SwitchParameter -Parameter Sets: ForVault -Aliases: +Parameter Sets: ForVault, InputObjectForVault +Aliases: EnabledForDiskEncryption Required: False Position: Named @@ -147,13 +178,13 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -EnabledForDiskEncryption -Enables the Azure disk encryption service to get secrets and unwrap keys from this key vault. +### -DisableTemplateDeployment +If specified, disables the retrieval of secrets from this key vault by Azure Resource Manager when referenced in templates. ```yaml Type: SwitchParameter -Parameter Sets: ForVault -Aliases: +Parameter Sets: ForVault, InputObjectForVault +Aliases: EnabledForTemplateDeployment Required: False Position: Named @@ -162,28 +193,43 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -EnabledForTemplateDeployment -Enables Azure Resource Manager to get secrets from this key vault when this key vault is referenced in a template deployment. +### -EmailAddress +Specifies the user email address of the user whose access you want to remove. ```yaml -Type: SwitchParameter -Parameter Sets: ForVault -Aliases: +Type: String +Parameter Sets: ByEmail, InputObjectByEmail +Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +Key Vault object. + +```yaml +Type: PSVault +Parameter Sets: InputObjectByObjectId, InputObjectByServicePrincipalName, InputObjectByUserPrincipalName, InputObjectByEmail, InputObjectForVault +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -ObjectId Specifies the object ID of the user or service principal in Azure Active Directory for which to remove permissions. ```yaml Type: String -Parameter Sets: ByObjectId -Aliases: +Parameter Sets: ByObjectId, InputObjectByObjectId +Aliases: Required: True Position: Named @@ -199,7 +245,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -214,8 +260,8 @@ If not specified, this cmdlet searches for the key vault in the current subscrip ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByUserPrincipalName, ByObjectId, ByServicePrincipalName, ByEmail, ForVault +Aliases: Required: False Position: 1 @@ -230,7 +276,7 @@ Specify the application ID, also known as client ID, registered for the applicat ```yaml Type: String -Parameter Sets: ByServicePrincipalName +Parameter Sets: ByServicePrincipalName, InputObjectByServicePrincipalName Aliases: SPN Required: True @@ -245,7 +291,7 @@ Specifies the user principal name of the user whose access you want to remove. ```yaml Type: String -Parameter Sets: ByUserPrincipalName +Parameter Sets: ByUserPrincipalName, InputObjectByUserPrincipalName Aliases: UPN Required: True @@ -261,8 +307,8 @@ This cmdlet removes permissions for the key vault that this parameter specifies. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByUserPrincipalName, ByObjectId, ByServicePrincipalName, ByEmail, ForVault +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md index 4b1f782795d3..ee99bc5aca08 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: C4E7ACDF-22FB-4D49-93B3-69E787B7E0CD @@ -13,9 +13,16 @@ Creates a key in a key vault from a backed-up key. ## SYNTAX +### ByVaultName (Default) +``` +Restore-AzureKeyVaultKey [-VaultName] [-InputFile] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ByInputObject ``` -Restore-AzureKeyVaultKey [-VaultName] [-InputFile] [-DefaultProfile ] - [-WhatIf] [-Confirm] [] +Restore-AzureKeyVaultKey [-InputObject] [-InputFile] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -58,9 +65,9 @@ Accept wildcard characters: False Specifies the input file that contains the backup of the key to restore. ```yaml -Type: String +Type: String[] Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 1 @@ -69,13 +76,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +KeyVault object + +```yaml +Type: PSVault +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -VaultName Specifies the name of the key vault into which to restore the key. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByVaultName +Aliases: Required: True Position: 0 @@ -122,7 +144,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md index 82e08dea051a..d402278e5bbf 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 70DB088D-4AF5-406B-8D66-118A0F766041 @@ -13,8 +13,15 @@ Creates a secret in a key vault from a backed-up secret. ## SYNTAX +### ByVaultName (Default) +``` +Restore-AzureKeyVaultSecret [-VaultName] [-InputFile] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ByInputObject ``` -Restore-AzureKeyVaultSecret [-VaultName] [-InputFile] +Restore-AzureKeyVaultSecret [-InputObject] [-InputFile] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -58,9 +65,9 @@ Accept wildcard characters: False Specifies the input file that contains the backup of the secret to restore. ```yaml -Type: String +Type: String[] Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 1 @@ -69,13 +76,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +KeyVault object` + +``yaml +Type: PSVault +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -VaultName Specifies the name of the key vault into which to restore the secret. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByVaultName +Aliases: Required: True Position: 0 @@ -122,7 +144,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.Secret +### Microsoft.Azure.Commands.KeyVault.Models.PSSecret ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateAttribute.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateAttribute.md index 6a1c49dc353a..4120ceeee1cd 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateAttribute.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateAttribute.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 3BD243C7-A40E-4061-93FF-DDE7DECAD0A7 @@ -13,12 +13,20 @@ Modifies editable attributes of a certificate. ## SYNTAX +### ByName (Default) ``` Set-AzureKeyVaultCertificateAttribute [-VaultName] [-Name] [[-Version] ] [-Enable ] [-Tag ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### ByInputObject +``` +Set-AzureKeyVaultCertificateAttribute [-InputObject] [[-Version] ] + [-Enable ] [-Tag ] [-PassThru] [-DefaultProfile ] [-WhatIf] + [-Confirm] [] +``` + ## DESCRIPTION The **Set-AzureKeyVaultCertificateAttribute** cmdlet modifies the editable attributes of a certificate. @@ -88,7 +96,7 @@ Specify $True to enable or $False to disable. ```yaml Type: Boolean Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -97,6 +105,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Certificate object + +```yaml +Type: PSKeyVaultCertificate +Parameter Sets: ByInputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of the certificate to modify. This cmdlet constructs the FQDN of a certificate based on the key vault name, your currently selected environment, the certificate name, and the @@ -104,7 +127,7 @@ certificate version. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: ByName Aliases: CertificateName Required: True @@ -121,7 +144,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -138,7 +161,7 @@ Key-value pairs in the form of a hash table. For example: ```yaml Type: Hashtable Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -153,8 +176,8 @@ This cmdlet constructs the FQDN of a key vault based on the name and currently s ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByName +Aliases: Required: True Position: 0 @@ -217,7 +240,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificate +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificate ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md index 7600898b4a92..8e7417cc4430 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 4C2C77F7-ECE4-4106-8AF1-256A496A977B @@ -16,16 +16,32 @@ Sets a certificate issuer in a key vault. ### Expanded (Default) ``` Set-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] [-IssuerProvider ] - [-AccountId ] [-ApiKey ] [-OrganizationDetails ] - [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-AccountId ] [-ApiKey ] + [-OrganizationDetails ] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### ByValue ``` -Set-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] -Issuer +Set-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] -Issuer [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObjectExpanded +``` +Set-AzureKeyVaultCertificateIssuer [-InputObject] [-Name] [-IssuerProvider ] + [-AccountId ] [-ApiKey ] + [-OrganizationDetails ] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### InputObjectByValue +``` +Set-AzureKeyVaultCertificateIssuer [-InputObject] [-Name] + -Issuer [-PassThru] [-DefaultProfile ] [-WhatIf] + [-Confirm] [] +``` + ## DESCRIPTION The Set-AzureKeyVaultCertificateIssuer cmdlet sets a certificate issuer in a key vault. @@ -45,8 +61,8 @@ Specifies the account ID for the certificate issuer. ```yaml Type: String -Parameter Sets: Expanded -Aliases: +Parameter Sets: Expanded, InputObjectExpanded +Aliases: Required: False Position: Named @@ -60,8 +76,8 @@ Specifies the API key for the certificate issuer. ```yaml Type: SecureString -Parameter Sets: Expanded -Aliases: +Parameter Sets: Expanded, InputObjectExpanded +Aliases: Required: False Position: Named @@ -85,18 +101,33 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Key Vault Object + +```yaml +Type: PSVault +Parameter Sets: InputObjectExpanded, InputObjectByValue +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Issuer Specifies the certificate issuer to update. ```yaml -Type: KeyVaultCertificateIssuer -Parameter Sets: ByValue -Aliases: +Type: PSKeyVaultCertificateIssuer +Parameter Sets: ByValue, InputObjectByValue +Aliases: Required: True Position: Named Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` @@ -105,8 +136,8 @@ Specifies the type of certificate issuer. ```yaml Type: String -Parameter Sets: Expanded -Aliases: +Parameter Sets: Expanded, InputObjectExpanded +Aliases: Required: False Position: Named @@ -134,9 +165,9 @@ Accept wildcard characters: False Organization details to be used with the issuer. ```yaml -Type: KeyVaultCertificateOrganizationDetails -Parameter Sets: Expanded -Aliases: +Type: PSKeyVaultCertificateOrganizationDetails +Parameter Sets: Expanded, InputObjectExpanded +Aliases: Required: False Position: Named @@ -152,7 +183,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -166,8 +197,8 @@ Specifies the name of the key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Expanded, ByValue +Aliases: Required: True Position: 0 @@ -214,7 +245,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificatePolicy ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md index d9b10e943b8c..4ae1c5e8cb9f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 28BC1B99-946C-4A8D-9581-4D5CC0BCEF8B @@ -13,25 +13,36 @@ Creates or updates the policy for a certificate in a key vault. ## SYNTAX -### Expanded (Default) +### ExpandedRenewPercentage (Default) ``` -Set-AzureKeyVaultCertificatePolicy [-VaultName] [-Name] [-SecretContentType ] - [-ReuseKeyOnRenewal ] [-Disabled] [-SubjectName ] +Set-AzureKeyVaultCertificatePolicy [-VaultName] [-Name] [-RenewAtPercentageLifetime ] + [-SecretContentType ] [-ReuseKeyOnRenewal ] [-Disabled] [-SubjectName ] [-DnsNames ] [-KeyUsage ] [-Ekus ] [-ValidityInMonths ] [-IssuerName ] - [-CertificateType ] [-RenewAtNumberOfDaysBeforeExpiry ] [-RenewAtPercentageLifetime ] - [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] [-KeyType ] - [-KeyNotExportable] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] + [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] + [-KeyType ] [-KeyNotExportable] [-PassThru] [-DefaultProfile ] [-WhatIf] + [-Confirm] [] ``` ### ByValue ``` Set-AzureKeyVaultCertificatePolicy [-VaultName] [-Name] - [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] [-KeyType ] - [[-CertificatePolicy] ] [-PassThru] [-DefaultProfile ] - [-WhatIf] [-Confirm] [] + [-InputObject] [-EmailAtNumberOfDaysBeforeExpiry ] + [-EmailAtPercentageLifetime ] [-KeyType ] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ExpandedRenewNumber +``` +Set-AzureKeyVaultCertificatePolicy [-VaultName] [-Name] + -RenewAtNumberOfDaysBeforeExpiry [-SecretContentType ] [-ReuseKeyOnRenewal ] + [-Disabled] [-SubjectName ] [-DnsNames ] + [-KeyUsage ] + [-Ekus ] [-ValidityInMonths ] [-IssuerName ] + [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] + [-KeyType ] [-KeyNotExportable] [-PassThru] [-DefaultProfile ] [-WhatIf] + [-Confirm] [] ``` ## DESCRIPTION @@ -48,28 +59,13 @@ This command sets the policy for the TestCert01 certificate in the ContosoKV01 k ## PARAMETERS -### -CertificatePolicy -Specifies the certificate policy. - -```yaml -Type: KeyVaultCertificatePolicy -Parameter Sets: ByValue -Aliases: - -Required: False -Position: 2 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -CertificateType Specifies the type of certificate to the issuer. ```yaml Type: String -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -98,8 +94,8 @@ Indicates that the certificate policy is disabled. ```yaml Type: SwitchParameter -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -113,8 +109,8 @@ Specifies the DNS names in the certificate. ```yaml Type: System.Collections.Generic.List`1[System.String] -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -128,8 +124,8 @@ Specifies the enhanced key usages (EKUs) in the certificate. ```yaml Type: System.Collections.Generic.List`1[System.String] -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -144,7 +140,7 @@ Specifies how many days before expiry the automatic notification process begins. ```yaml Type: Int32 Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -159,7 +155,7 @@ Specifies the percentage of the lifetime after which the automatic process for t ```yaml Type: Int32 Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -168,13 +164,28 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +Specifies the certificate policy. + +```yaml +Type: PSKeyVaultCertificatePolicy +Parameter Sets: ByValue +Aliases: CertificatePolicy + +Required: True +Position: 2 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + ### -IssuerName Specifies the name of the issuer for this certificate. ```yaml Type: String -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -188,8 +199,8 @@ Indicates that the key is not exportable. ```yaml Type: SwitchParameter -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -208,7 +219,7 @@ The acceptable values for this parameter are: ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Accepted values: RSA, RSA-HSM Required: False @@ -223,8 +234,8 @@ Specifies the key usages in the certificate. ```yaml Type: System.Collections.Generic.List`1[System.String] -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -255,7 +266,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -269,10 +280,10 @@ Specifies the number of days before expiry after which the automatic process for ```yaml Type: Int32 -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewNumber +Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) @@ -284,8 +295,8 @@ Specifies the percentage of the lifetime after which the automatic process for c ```yaml Type: Int32 -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage +Aliases: Required: False Position: Named @@ -299,8 +310,8 @@ Indicates that the certificate reuse the key during renewal. ```yaml Type: Boolean -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -318,8 +329,8 @@ The acceptable values for this parameter are: ```yaml Type: String -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Accepted values: application/x-pkcs12, application/x-pem-file Required: False @@ -334,8 +345,8 @@ Specifies the subject name of the certificate. ```yaml Type: String -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -349,8 +360,8 @@ Specifies the number of months the certificate is valid. ```yaml Type: Int32 -Parameter Sets: Expanded -Aliases: +Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber +Aliases: Required: False Position: Named @@ -365,7 +376,7 @@ Specifies the name of a key vault. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 @@ -412,7 +423,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificatePolicy ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultKeyAttribute.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultKeyAttribute.md index b214b3afe8c5..e1c7beeaf625 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultKeyAttribute.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultKeyAttribute.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/set-azurekeyvaultkeyattribute @@ -12,12 +12,20 @@ Updates the attributes of a key in a key vault. ## SYNTAX +### Default (Default) ``` Set-AzureKeyVaultKeyAttribute [-VaultName] [-Name] [[-Version] ] [-Enable ] [-Expires ] [-NotBefore ] [-KeyOps ] [-Tag ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Set-AzureKeyVaultKeyAttribute [-InputObject] [[-Version] ] [-Enable ] + [-Expires ] [-NotBefore ] [-KeyOps ] [-Tag ] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Set-AzureKeyVaultKeyAttribute** cmdlet updates the editable attributes of a key in a key vault. @@ -71,7 +79,7 @@ the key. ```yaml Type: Boolean Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -88,7 +96,7 @@ parameter uses Coordinated Universal Time (UTC). To obtain a **DateTime** object ```yaml Type: DateTime Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -97,6 +105,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +Key object + +```yaml +Type: PSKeyBundle +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -KeyOps Specifies an array of operations that can be performed by using the key that this cmdlet adds. If you do not specify this parameter, all operations can be performed. @@ -116,7 +139,7 @@ the JSON Web Key specification. These values (case-sensitive) are: ```yaml Type: String[] Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -132,7 +155,7 @@ your current environment. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Default Aliases: KeyName Required: True @@ -150,7 +173,7 @@ To obtain a **DateTime** object, use the **Get-Date** cmdlet. ```yaml Type: DateTime Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -166,7 +189,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -198,8 +221,8 @@ This cmdlet constructs the FQDN of a key vault based on the name that this param ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 @@ -262,7 +285,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultManagedStorageSasDefinition.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultManagedStorageSasDefinition.md index 222f72b6d0e1..69d3e4547829 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultManagedStorageSasDefinition.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultManagedStorageSasDefinition.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/set-azurekeyvaultmanagedstoragesasdefinition @@ -186,7 +186,7 @@ Specifies the storage service version to use to execute the request made using t ```yaml Type: String Parameter Sets: AdhocAccountSas -Aliases: +Aliases: Required: False Position: Named @@ -201,7 +201,7 @@ Blob Name ```yaml Type: String Parameter Sets: AdhocServiceBlobSas, StoredPolicyServiceBlobSas -Aliases: +Aliases: Required: True Position: Named @@ -216,7 +216,7 @@ Container Name ```yaml Type: String Parameter Sets: AdhocServiceBlobSas, AdhocServiceContainerSas, StoredPolicyServiceBlobSas, StoredPolicyServiceContainerSas -Aliases: +Aliases: Required: True Position: Named @@ -246,7 +246,7 @@ Disables the use of sas definition for generation of sas token. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -291,7 +291,7 @@ IP, or IP range ACL (access control list) of the request that would be accepted ```yaml Type: String Parameter Sets: AdhocAccountSas, AdhocServiceBlobSas, AdhocServiceContainerSas, AdhocServiceFileSas, AdhocServiceShareSas, AdhocServiceQueueSas, AdhocServiceTableSas, StoredPolicyServiceBlobSas, StoredPolicyServiceContainerSas, StoredPolicyServiceFileSas, StoredPolicyServiceShareSas, StoredPolicyServiceQueueSas, StoredPolicyServiceTableSas -Aliases: +Aliases: Required: False Position: Named @@ -322,7 +322,7 @@ Sas definition parameters that will be used to create the sas token. ```yaml Type: Hashtable Parameter Sets: RawSas -Aliases: +Aliases: Required: True Position: 3 @@ -337,7 +337,7 @@ Path to the cloud file to generate sas token against. ```yaml Type: String Parameter Sets: AdhocServiceFileSas, StoredPolicyServiceFileSas -Aliases: +Aliases: Required: True Position: Named @@ -352,7 +352,7 @@ Permission. Values include 'Query','Add','Update','Process' ```yaml Type: String[] Parameter Sets: AdhocAccountSas, AdhocServiceBlobSas, AdhocServiceContainerSas, AdhocServiceFileSas, AdhocServiceShareSas, AdhocServiceQueueSas, AdhocServiceTableSas -Aliases: +Aliases: Accepted values: Add, Create, Delete, List, Process, Read, Query, Update, Write Required: True @@ -368,7 +368,7 @@ Policy Identifier ```yaml Type: String Parameter Sets: StoredPolicyServiceBlobSas, StoredPolicyServiceContainerSas, StoredPolicyServiceFileSas, StoredPolicyServiceShareSas, StoredPolicyServiceQueueSas, StoredPolicyServiceTableSas -Aliases: +Aliases: Required: True Position: Named @@ -383,7 +383,7 @@ Protocol can be used in the request with the SAS token. ```yaml Type: String Parameter Sets: AdhocAccountSas, AdhocServiceBlobSas, AdhocServiceContainerSas, AdhocServiceFileSas, AdhocServiceShareSas, AdhocServiceQueueSas, AdhocServiceTableSas, StoredPolicyServiceBlobSas, StoredPolicyServiceContainerSas, StoredPolicyServiceFileSas, StoredPolicyServiceShareSas, StoredPolicyServiceQueueSas, StoredPolicyServiceTableSas -Aliases: +Aliases: Accepted values: HttpsOnly, HttpsOrHttp Required: False @@ -399,7 +399,7 @@ Queue Name ```yaml Type: String Parameter Sets: AdhocServiceQueueSas, StoredPolicyServiceQueueSas -Aliases: +Aliases: Required: True Position: Named @@ -414,7 +414,7 @@ Resource types that this SAS token applies to. Values include 'Service','Contain ```yaml Type: String[] Parameter Sets: AdhocAccountSas -Aliases: +Aliases: Accepted values: Service, Container, Object Required: True @@ -430,7 +430,7 @@ Service types that this SAS token applies to. Values include 'Blob','File','Queu ```yaml Type: String[] Parameter Sets: AdhocAccountSas -Aliases: +Aliases: Accepted values: Blob, File, Queue, Table Required: True @@ -446,7 +446,7 @@ Share Name ```yaml Type: String Parameter Sets: AdhocServiceFileSas, AdhocServiceShareSas, StoredPolicyServiceFileSas, StoredPolicyServiceShareSas -Aliases: +Aliases: Required: True Position: Named @@ -461,7 +461,7 @@ Specifies the query parameters to override response headers. ```yaml Type: String[] Parameter Sets: AdhocServiceBlobSas, AdhocServiceContainerSas, AdhocServiceFileSas, AdhocServiceShareSas, StoredPolicyServiceBlobSas, StoredPolicyServiceContainerSas, StoredPolicyServiceFileSas, StoredPolicyServiceShareSas -Aliases: +Aliases: Accepted values: CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, ContentType Required: False @@ -507,7 +507,7 @@ Table Name ```yaml Type: String Parameter Sets: AdhocServiceTableSas, StoredPolicyServiceTableSas -Aliases: +Aliases: Required: True Position: Named @@ -539,7 +539,7 @@ Specifies the signed storage service version to use to authenticate requests mad ```yaml Type: String Parameter Sets: AdhocAccountSas, AdhocServiceBlobSas, AdhocServiceContainerSas, AdhocServiceFileSas, AdhocServiceShareSas, AdhocServiceQueueSas, AdhocServiceTableSas, StoredPolicyServiceBlobSas, StoredPolicyServiceContainerSas, StoredPolicyServiceFileSas, StoredPolicyServiceShareSas, StoredPolicyServiceQueueSas, StoredPolicyServiceTableSas -Aliases: +Aliases: Required: False Position: Named @@ -554,7 +554,7 @@ Validity period that will get used to set the expiry time of sas token from the ```yaml Type: TimeSpan Parameter Sets: AdhocAccountSas, AdhocServiceBlobSas, AdhocServiceContainerSas, AdhocServiceFileSas, AdhocServiceShareSas, AdhocServiceQueueSas, AdhocServiceTableSas -Aliases: +Aliases: Required: True Position: Named @@ -570,7 +570,7 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecret.md index 5578125ec9b2..cf219e8ef89a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecret.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 9FC72DE9-46BB-4CB5-9880-F53756DBE012 @@ -13,12 +13,20 @@ Creates or updates a secret in a key vault. ## SYNTAX +### Default (Default) ``` Set-AzureKeyVaultSecret [-VaultName] [-Name] [-SecretValue] [-Disable] [-Expires ] [-NotBefore ] [-ContentType ] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Set-AzureKeyVaultSecret [-InputObject] [-SecretValue] [-Disable] + [-Expires ] [-NotBefore ] [-ContentType ] [-Tag ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Set-AzureKeyVaultSecret** cmdlet creates or updates a secret in a key vault in Azure Key Vault. If the secret does not exist, this cmdlet creates it. If the secret already exists, this @@ -68,7 +76,7 @@ To delete the existing content type, specify an empty string. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -98,7 +106,7 @@ Indicates that this cmdlet disables a secret. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -115,7 +123,7 @@ This parameter uses Coordinated Universal Time (UTC). To obtain a **DateTime** o ```yaml Type: DateTime Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -124,6 +132,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +Secret object + +```yaml +Type: PSSecret +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of a secret to modify. This cmdlet constructs the fully qualified domain name (FQDN) of a secret based on the name that this parameter specifies, the name of the key vault, and @@ -131,7 +154,7 @@ your current environment. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Default Aliases: SecretName Required: True @@ -148,7 +171,7 @@ parameter uses UTC. To obtain a **DateTime** object, use the **Get-Date** cmdlet ```yaml Type: DateTime Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -165,7 +188,7 @@ ConvertTo-SecureString`. ```yaml Type: SecureString Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 2 @@ -197,8 +220,8 @@ of a key vault based on the name that this parameter specifies and your current ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 @@ -245,7 +268,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.Secret +### Microsoft.Azure.Commands.KeyVault.Models.PSSecret ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecretAttribute.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecretAttribute.md index a8b0048ff5a3..ba475fe941aa 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecretAttribute.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecretAttribute.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: E2A45461-6B41-42FF-A874-A4CEFC867A33 @@ -13,12 +13,20 @@ Updates attributes of a secret in a key vault. ## SYNTAX +### Default ``` Set-AzureKeyVaultSecretAttribute [-VaultName] [-Name] [[-Version] ] [-Enable ] [-Expires ] [-NotBefore ] [-ContentType ] [-Tag ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Set-AzureKeyVaultSecretAttribute [-InputObject] [[-Version] ] [-Enable ] + [-Expires ] [-NotBefore ] [-ContentType ] [-Tag ] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Set-AzureKeyVaultSecretAttribute** cmdlet updates editable attributes of a secret in a key vault. @@ -85,7 +93,7 @@ the current secret's content type. To remove the existing content type, specify ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -117,7 +125,7 @@ disabled state. ```yaml Type: Boolean Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -132,7 +140,7 @@ Specifies the date and time that a secret expires. ```yaml Type: DateTime Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -141,6 +149,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +Secret object + +```yaml +Type: PSSecret +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of a secret. This cmdlet constructs the fully qualified domain name (FQDN) of a secret based on the name that this parameter specifies, the name of the key vault, and your current @@ -148,7 +171,7 @@ environment. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Default Aliases: SecretName Required: True @@ -165,7 +188,7 @@ If you do not specify this parameter, there is no change to the current secret's ```yaml Type: DateTime Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -181,7 +204,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -213,8 +236,8 @@ This cmdlet constructs the FQDN of a key vault based on the name that this param ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 @@ -277,7 +300,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.Secret +### Microsoft.Azure.Commands.KeyVault.Models.PSSecret Returns Microsoft.Azure.Commands.KeyVault.Models.Secret object if PassThru is specified. Otherwise, returns nothing. ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureRmKeyVaultAccessPolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureRmKeyVaultAccessPolicy.md index 28ed11793318..5cbeaf7afb52 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureRmKeyVaultAccessPolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureRmKeyVaultAccessPolicy.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 636FAD5B-8C39-4E5C-8978-6845C6B89BC0 @@ -13,15 +13,7 @@ Grants or modifies existing permissions for a user, application, or security gro ## SYNTAX -### ByServicePrincipalName -``` -Set-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] - -ServicePrincipalName [-PermissionsToKeys ] [-PermissionsToSecrets ] - [-PermissionsToCertificates ] [-PermissionsToStorage ] [-PassThru] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] -``` - -### ByUserPrincipalName +### ByUserPrincipalName (Default) ``` Set-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] -UserPrincipalName [-PermissionsToKeys ] [-PermissionsToSecrets ] @@ -37,6 +29,14 @@ Set-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] [-WhatIf] [-Confirm] [] ``` +### ByServicePrincipalName +``` +Set-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] + -ServicePrincipalName [-PermissionsToKeys ] [-PermissionsToSecrets ] + [-PermissionsToCertificates ] [-PermissionsToStorage ] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ### ByEmailAddress ``` Set-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] -EmailAddress @@ -52,6 +52,44 @@ Set-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] [-WhatIf] [-Confirm] [] ``` +### InputObjectByObjectId +``` +Set-AzureRmKeyVaultAccessPolicy [-InputObject] -ObjectId [-ApplicationId ] + [-PermissionsToKeys ] [-PermissionsToSecrets ] [-PermissionsToCertificates ] + [-PermissionsToStorage ] [-BypassObjectIdValidation] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### InputObjectByServicePrincipalName +``` +Set-AzureRmKeyVaultAccessPolicy [-InputObject] -ServicePrincipalName + [-PermissionsToKeys ] [-PermissionsToSecrets ] [-PermissionsToCertificates ] + [-PermissionsToStorage ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +### InputObjectByUserPrincipalName +``` +Set-AzureRmKeyVaultAccessPolicy [-InputObject] -UserPrincipalName + [-PermissionsToKeys ] [-PermissionsToSecrets ] [-PermissionsToCertificates ] + [-PermissionsToStorage ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +### InputObjectByEmailAddress +``` +Set-AzureRmKeyVaultAccessPolicy [-InputObject] -EmailAddress [-PermissionsToKeys ] + [-PermissionsToSecrets ] [-PermissionsToCertificates ] [-PermissionsToStorage ] + [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### InputObjectForVault +``` +Set-AzureRmKeyVaultAccessPolicy [-InputObject] [-EnabledForDeployment] + [-EnabledForTemplateDeployment] [-EnabledForDiskEncryption] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Set-AzureRmKeyVaultAccessPolicy** cmdlet grants or modifies existing permissions for a user, application, or security group to perform the specified operations with a key vault. It does not modify the permissions that other users, applications, or security groups have on the key vault. @@ -154,8 +192,8 @@ For future use. ```yaml Type: Guid -Parameter Sets: ByObjectId -Aliases: +Parameter Sets: ByObjectId, InputObjectByObjectId +Aliases: Required: False Position: Named @@ -171,8 +209,8 @@ Use this parameter only if you want to grant access to your key vault to an obje ```yaml Type: SwitchParameter -Parameter Sets: ByObjectId -Aliases: +Parameter Sets: ByObjectId, InputObjectByObjectId +Aliases: Required: False Position: Named @@ -203,8 +241,8 @@ This email address must exist in the directory associated with the current subsc ```yaml Type: String -Parameter Sets: ByEmailAddress -Aliases: +Parameter Sets: ByEmailAddress, InputObjectByEmailAddress +Aliases: Required: True Position: Named @@ -218,8 +256,8 @@ Enables the Microsoft.Compute resource provider to retrieve secrets from this ke ```yaml Type: SwitchParameter -Parameter Sets: ForVault -Aliases: +Parameter Sets: ForVault, InputObjectForVault +Aliases: Required: False Position: Named @@ -233,8 +271,8 @@ Enables the Azure disk encryption service to get secrets and unwrap keys from th ```yaml Type: SwitchParameter -Parameter Sets: ForVault -Aliases: +Parameter Sets: ForVault, InputObjectForVault +Aliases: Required: False Position: Named @@ -248,8 +286,8 @@ Enables Azure Resource Manager to get secrets from this key vault when this key ```yaml Type: SwitchParameter -Parameter Sets: ForVault -Aliases: +Parameter Sets: ForVault, InputObjectForVault +Aliases: Required: False Position: Named @@ -258,13 +296,28 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -InputObject +Key Vault Object + +```yaml +Type: PSVault +Parameter Sets: InputObjectByObjectId, InputObjectByServicePrincipalName, InputObjectByUserPrincipalName, InputObjectByEmailAddress, InputObjectForVault +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -ObjectId Specifies the object ID of the user or service principal in Azure Active Directory for which to grant permissions. ```yaml Type: String -Parameter Sets: ByObjectId -Aliases: +Parameter Sets: ByObjectId, InputObjectByObjectId +Aliases: Required: True Position: Named @@ -281,7 +334,7 @@ By default, this cmdlet does not generate any output. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -310,8 +363,8 @@ The acceptable values for this parameter: ```yaml Type: String[] -Parameter Sets: ByServicePrincipalName, ByUserPrincipalName, ByObjectId, ByEmailAddress -Aliases: +Parameter Sets: ByUserPrincipalName, ByObjectId, ByServicePrincipalName, ByEmailAddress, InputObjectByObjectId, InputObjectByServicePrincipalName, InputObjectByUserPrincipalName, InputObjectByEmailAddress +Aliases: Accepted values: get, list, delete, create, import, update, managecontacts, getissuers, listissuers, setissuers, deleteissuers, manageissuers, recover, purge, all Required: False @@ -345,8 +398,8 @@ The acceptable values for this parameter: ```yaml Type: String[] -Parameter Sets: ByServicePrincipalName, ByUserPrincipalName, ByObjectId, ByEmailAddress -Aliases: +Parameter Sets: ByUserPrincipalName, ByObjectId, ByServicePrincipalName, ByEmailAddress, InputObjectByObjectId, InputObjectByServicePrincipalName, InputObjectByUserPrincipalName, InputObjectByEmailAddress +Aliases: Accepted values: decrypt, encrypt, unwrapKey, wrapKey, verify, sign, get, list, update, create, import, delete, backup, restore, recover, purge, all Required: False @@ -372,8 +425,8 @@ The acceptable values for this parameter: ```yaml Type: String[] -Parameter Sets: ByServicePrincipalName, ByUserPrincipalName, ByObjectId, ByEmailAddress -Aliases: +Parameter Sets: ByUserPrincipalName, ByObjectId, ByServicePrincipalName, ByEmailAddress, InputObjectByObjectId, InputObjectByServicePrincipalName, InputObjectByUserPrincipalName, InputObjectByEmailAddress +Aliases: Accepted values: get, list, set, delete, backup, restore, recover, purge, all Required: False @@ -388,8 +441,8 @@ Specifies managed storage account and SaS-definition operation permissions to gr ```yaml Type: String[] -Parameter Sets: ByServicePrincipalName, ByUserPrincipalName, ByObjectId, ByEmailAddress -Aliases: +Parameter Sets: ByUserPrincipalName, ByObjectId, ByServicePrincipalName, ByEmailAddress, InputObjectByObjectId, InputObjectByServicePrincipalName, InputObjectByUserPrincipalName, InputObjectByEmailAddress +Aliases: Accepted values: get, list, delete, set, update, regeneratekey, getsas, listsas, deletesas, setsas, all Required: False @@ -404,8 +457,8 @@ Specifies the name of a resource group. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByUserPrincipalName, ByObjectId, ByServicePrincipalName, ByEmailAddress, ForVault +Aliases: Required: False Position: 1 @@ -421,7 +474,7 @@ Specify the application ID, also known as client ID, registered for the applicat ```yaml Type: String -Parameter Sets: ByServicePrincipalName +Parameter Sets: ByServicePrincipalName, InputObjectByServicePrincipalName Aliases: SPN Required: True @@ -438,7 +491,7 @@ This user principal name must exist in the directory associated with the current ```yaml Type: String -Parameter Sets: ByUserPrincipalName +Parameter Sets: ByUserPrincipalName, InputObjectByUserPrincipalName Aliases: UPN Required: True @@ -455,8 +508,8 @@ This cmdlet modifies the access policy for the key vault that this parameter spe ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: ByUserPrincipalName, ByObjectId, ByServicePrincipalName, ByEmailAddress, ForVault +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Stop-AzureKeyVaultCertificateOperation.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Stop-AzureKeyVaultCertificateOperation.md index e6db05a1e007..6fa17e524e15 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Stop-AzureKeyVaultCertificateOperation.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Stop-AzureKeyVaultCertificateOperation.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 3B042D79-658F-41F0-BD4D-9955F2E71CA1 @@ -13,11 +13,18 @@ Cancels a certificate operation in key vault. ## SYNTAX +### Default (Default) ``` Stop-AzureKeyVaultCertificateOperation [-VaultName] [-Name] [-Force] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Stop-AzureKeyVaultCertificateOperation [-InputObject] [-Force] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Stop-AzureKeyVaultCertificateOperation** cmdlet cancels a certificate operation in the Azure Key Vault service. @@ -63,7 +70,7 @@ Forces the command to run without asking for user confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -72,12 +79,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Operation object + +```yaml +Type: PSKeyVaultCertificateOperation +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Specifies the name of a certificate. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Default Aliases: CertificateName Required: True @@ -92,8 +114,8 @@ Specifies the name of a key vault. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 @@ -141,7 +163,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateOperation ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultCertificateRemoval.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultCertificateRemoval.md index d275ac1447d5..74819c2ac69a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultCertificateRemoval.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultCertificateRemoval.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/undo-azurekeyvaultcertificateremoval @@ -12,11 +12,18 @@ Recovers a deleted certificate in a key vault into an active state. ## SYNTAX +### Default (Default) ``` Undo-AzureKeyVaultCertificateRemoval [-VaultName] [-Name] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Undo-AzureKeyVaultCertificateRemoval [-InputObject] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Undo-AzureKeyVaultCertificateRemoval** cmdlet will recover a previously deleted certificate. The recovered certificate will be active and can be used for all operations. @@ -48,13 +55,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Deleted Certificate object + +```yaml +Type: PSDeletedKeyVaultCertificate +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Certificate name. Cmdlet constructs the FQDN of a certificate from vault name, currently selected environment and certificate name. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Default Aliases: CertificateName Required: True @@ -70,8 +92,8 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 @@ -120,7 +142,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.Certificate +### Microsoft.Azure.Commands.KeyVault.Models.CertificateBundle ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultKeyRemoval.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultKeyRemoval.md index 142de60a73db..cd2443dac01c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultKeyRemoval.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultKeyRemoval.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/undo-azurekeyvaultkeyremoval @@ -12,11 +12,18 @@ Recovers a deleted key in a key vault into an active state. ## SYNTAX +### Default (Default) ``` Undo-AzureKeyVaultKeyRemoval [-VaultName] [-Name] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Undo-AzureKeyVaultKeyRemoval [-InputObject] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Undo-AzureKeyVaultKeyRemoval** cmdlet will recover a previously deleted key. The recovered key will be active and can be used for all normal key operations. @@ -48,13 +55,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Deleted key object + +```yaml +Type: PSDeletedKeyBundle +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Key name. Cmdlet constructs the FQDN of a key from vault name, currently selected environment and key name. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Default Aliases: KeyName Required: True @@ -70,8 +92,8 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 @@ -120,7 +142,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.KeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultSecretRemoval.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultSecretRemoval.md index 14f80fd13f39..c67569388cbd 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultSecretRemoval.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultSecretRemoval.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/undo-azurekeyvaultsecretremoval @@ -12,11 +12,18 @@ Recovers a deleted secret in a key vault into an active state. ## SYNTAX +### Default (Default) ``` Undo-AzureKeyVaultSecretRemoval [-VaultName] [-Name] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Undo-AzureKeyVaultSecretRemoval [-InputObject] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Undo-AzureKeyVaultSecretRemoval** cmdlet will recover a previously deleted secret. The recovered secret will be active and can be used for all normal secret operations. @@ -48,13 +55,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Deleted secret object + +```yaml +Type: PSDeletedSecret +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Name Secret name. Cmdlet constructs the FQDN of a secret from vault name, currently selected environment and secret name. ```yaml Type: String -Parameter Sets: (All) +Parameter Sets: Default Aliases: SecretName Required: True @@ -70,8 +92,8 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 @@ -120,7 +142,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.Secret +### Microsoft.Azure.Commands.KeyVault.Models.PSSecret ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureRmKeyVaultRemoval.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureRmKeyVaultRemoval.md index 900dd38832b6..308e05489286 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureRmKeyVaultRemoval.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureRmKeyVaultRemoval.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/undo-azurermkeyvaultremoval @@ -12,11 +12,18 @@ Recovers a deleted key vault into an active state. ## SYNTAX +### Default (Default) ``` Undo-AzureRmKeyVaultRemoval [-VaultName] [-ResourceGroupName] [-Location] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` +### InputObject +``` +Undo-AzureRmKeyVaultRemoval [-InputObject] [-ResourceGroupName] [-Tag ] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + ## DESCRIPTION The **Undo-AzureRmKeyVaultRemoval** cmdlet will recover a previously deleted key vault. The recovered vault will be active after recovery @@ -49,13 +56,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -InputObject +Deleted vault object + +```yaml +Type: PSDeletedVault +Parameter Sets: InputObject +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + ### -Location Specifies the deleted vault original Azure region. ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 2 @@ -70,7 +92,7 @@ Specifies the name of an existing resource group in which to create the key vaul ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 1 @@ -87,7 +109,7 @@ Key-value pairs in the form of a hash table. For example: ```yaml Type: Hashtable Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -102,8 +124,8 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String -Parameter Sets: (All) -Aliases: +Parameter Sets: Default +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Update-AzureKeyVaultManagedStorageAccount.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Update-AzureKeyVaultManagedStorageAccount.md index d97740775c79..8aa44c3b3031 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Update-AzureKeyVaultManagedStorageAccount.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Update-AzureKeyVaultManagedStorageAccount.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/update-azurekeyvaultmanagedstorageaccount @@ -57,7 +57,7 @@ If not specified, the existing value of managed storage account's active key nam ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -73,7 +73,7 @@ If not specified, the existing value of auto regenerate key of managed storage a ```yaml Type: Boolean Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -106,7 +106,7 @@ unchanged. ```yaml Type: Boolean Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -122,7 +122,7 @@ account object. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -140,7 +140,7 @@ unchanged ```yaml Type: TimeSpan Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -173,7 +173,7 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Update-AzureKeyVaultManagedStorageAccountKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Update-AzureKeyVaultManagedStorageAccountKey.md index fefc9cfa1c82..6385f0a1574a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Update-AzureKeyVaultManagedStorageAccountKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Update-AzureKeyVaultManagedStorageAccountKey.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault online version: https://docs.microsoft.com/en-us/powershell/module/azurerm.keyvault/update-azurekeyvaultmanagedstorageaccountkey @@ -67,7 +67,7 @@ Do not ask for confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -82,7 +82,7 @@ Name of storage account key to regenerate and make active. ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 2 @@ -98,7 +98,7 @@ If this switch is specified, cmdlet returns the managed storage account that was ```yaml Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: Required: False Position: Named @@ -114,7 +114,7 @@ Cmdlet constructs the FQDN of a vault based on the name and currently selected e ```yaml Type: String Parameter Sets: (All) -Aliases: +Aliases: Required: True Position: 0 From 8b662fb3fda62690e6f7f802bcf27ae057c5dc86 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Thu, 1 Mar 2018 17:25:41 -0800 Subject: [PATCH 07/19] fix output types --- .../UnitTests/RemoveKeyVaultKeyTests.cs | 16 +-- .../UnitTests/RemoveKeyVaultSecretTests.cs | 8 +- .../UnitTests/SetKeyVaultKeyAttributeTests.cs | 18 +-- .../SetKeyVaultSecretAttributeTests.cs | 16 +-- .../UnitTests/SetKeyVaultSecretTests.cs | 16 +-- .../Commands.KeyVault.csproj | 34 ++--- .../AddAzureKeyVaultCertificateContact.cs | 2 +- .../Commands/AddAzureKeyVaultKey.cs | 10 +- .../Commands/BackupAzureKeyVaultKey.cs | 2 +- .../Commands/BackupAzureKeyVaultSecret.cs | 2 +- .../Commands/GetAzureKeyVault.cs | 6 +- .../Commands/GetAzureKeyVaultCertificate.cs | 6 +- .../GetAzureKeyVaultCertificateContact.cs | 2 +- .../GetAzureKeyVaultCertificateIssuer.cs | 6 +- .../GetAzureKeyVaultCertificateOperation.cs | 2 +- .../GetAzureKeyVaultCertificatePolicy.cs | 2 +- .../Commands/GetAzureKeyVaultKey.cs | 10 +- .../Commands/GetAzureKeyVaultSecret.cs | 10 +- .../Commands/NewAzureKeyVault.cs | 2 +- .../Commands/RemoveAzureKeyVault.cs | 17 ++- .../RemoveAzureKeyVaultAccessPolicy.cs | 8 +- .../RemoveAzureKeyVaultCertificate.cs | 2 +- .../RemoveAzureKeyVaultCertificateIssuer.cs | 2 +- .../Commands/RemoveAzureKeyVaultKey.cs | 6 +- .../Commands/RemoveAzureKeyVaultSecret.cs | 6 +- .../Commands/RestoreAzureKeyVaultKey.cs | 4 +- .../Commands/RestoreAzureKeyVaultSecret.cs | 4 +- .../Commands/SetAzureKeyVaultAccessPolicy.cs | 12 +- .../SetAzureKeyVaultCertificateAttribute.cs | 2 +- .../SetAzureKeyVaultCertificateIssuer.cs | 6 +- .../Commands/SetAzureKeyVaultKeyAttribute.cs | 6 +- .../Commands/SetAzureKeyVaultSecret.cs | 6 +- .../SetAzureKeyVaultSecretAttribute.cs | 6 +- .../UndoAzureKeyVaultCertificateRemoval.cs | 2 +- .../Commands/UndoAzureKeyVaultKeyRemoval.cs | 6 +- .../Commands/UndoAzureKeyVaultRemoval.cs | 4 +- .../UndoAzureKeyVaultSecretRemoval.cs | 6 +- ...soft.Azure.Commands.KeyVault.format.ps1xml | 24 ++-- .../Models/IKeyVaultDataServiceClient.cs | 50 ++++---- .../Models/KeyVaultDataServiceClient.cs | 114 ++++++++--------- .../Models/KeyVaultManagementCmdletBase.cs | 8 +- .../Models/ModelExtensions.cs | 4 +- .../Models/PSDeletedKeyIdentityItem.cs | 38 ------ ...PSDeletedVault.cs => PSDeletedKeyVault.cs} | 4 +- .../Models/PSDeletedKeyVaultCertificate.cs | 117 ++++++++++++++++-- ...DeletedKeyVaultCertificateIdentityItem.cs} | 9 +- .../Models/PSDeletedKeyVaultKey.cs | 66 ++++++++++ ...cs => PSDeletedKeyVaultKeyIdentityItem.cs} | 11 +- .../Models/PSDeletedKeyVaultSecret.cs | 80 ++++++++++++ ...=> PSDeletedKeyVaultSecretIdentityItem.cs} | 13 +- .../Models/PSDeletedSecret.cs | 41 ------ .../Models/{PSVault.cs => PSKeyVault.cs} | 10 +- ...essPolicy.cs => PSKeyVaultAccessPolicy.cs} | 6 +- .../Models/PSKeyVaultCertificate.cs | 90 ++++++++++---- ...s => PSKeyVaultCertificateIdentityItem.cs} | 13 +- .../Models/PSKeyVaultCertificateIssuer.cs | 6 +- ...SKeyVaultCertificateIssuerIdentityItem.cs} | 11 +- ...ntityItem.cs => PSKeyVaultIdentityItem.cs} | 6 +- .../{PSKeyBundle.cs => PSKeyVaultKey.cs} | 18 ++- ...tributes.cs => PSKeyVaultKeyAttributes.cs} | 10 +- ...tyItem.cs => PSKeyVaultKeyIdentityItem.cs} | 17 +-- .../{PSSecret.cs => PSKeyVaultSecret.cs} | 18 ++- ...butes.cs => PSKeyVaultSecretAttributes.cs} | 10 +- ...tem.cs => PSKeyVaultSecretIdentityItem.cs} | 13 +- .../Models/VaultManagementClient.cs | 24 ++-- .../Add-AzureKeyVaultCertificateContact.md | 4 +- .../help/Add-AzureKeyVaultKey.md | 8 +- .../help/Backup-AzureKeyVaultKey.md | 4 +- .../help/Backup-AzureKeyVaultSecret.md | 4 +- .../help/Get-AzureKeyVaultCertificate.md | 10 +- .../Get-AzureKeyVaultCertificateContact.md | 4 +- .../Get-AzureKeyVaultCertificateIssuer.md | 6 +- .../Get-AzureKeyVaultCertificateOperation.md | 4 +- .../Get-AzureKeyVaultCertificatePolicy.md | 4 +- .../help/Get-AzureKeyVaultKey.md | 10 +- .../help/Get-AzureKeyVaultSecret.md | 10 +- .../help/Get-AzureRmKeyVault.md | 8 +- .../help/Import-AzureKeyVaultCertificate.md | 2 +- .../help/New-AzureRmKeyVault.md | 2 +- .../help/Remove-AzureKeyVaultCertificate.md | 8 +- .../Remove-AzureKeyVaultCertificateIssuer.md | 6 +- .../help/Remove-AzureKeyVaultKey.md | 6 +- .../help/Remove-AzureKeyVaultSecret.md | 6 +- .../help/Remove-AzureRmKeyVault.md | 29 ++++- .../Remove-AzureRmKeyVaultAccessPolicy.md | 18 +-- .../help/Restore-AzureKeyVaultKey.md | 6 +- .../help/Restore-AzureKeyVaultSecret.md | 10 +- .../Set-AzureKeyVaultCertificateAttribute.md | 4 +- .../Set-AzureKeyVaultCertificateIssuer.md | 17 +-- .../help/Set-AzureKeyVaultKeyAttribute.md | 10 +- .../help/Set-AzureKeyVaultSecret.md | 6 +- .../help/Set-AzureKeyVaultSecretAttribute.md | 10 +- .../help/Set-AzureRmKeyVaultAccessPolicy.md | 19 +-- .../Undo-AzureKeyVaultCertificateRemoval.md | 4 +- .../help/Undo-AzureKeyVaultKeyRemoval.md | 8 +- .../help/Undo-AzureKeyVaultSecretRemoval.md | 8 +- .../help/Undo-AzureRmKeyVaultRemoval.md | 6 +- 97 files changed, 821 insertions(+), 546 deletions(-) delete mode 100644 src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyIdentityItem.cs rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSDeletedVault.cs => PSDeletedKeyVault.cs} (93%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSDeletedCertificateIdentityItem.cs => PSDeletedKeyVaultCertificateIdentityItem.cs} (77%) create mode 100644 src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultKey.cs rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSDeletedKeyBundle.cs => PSDeletedKeyVaultKeyIdentityItem.cs} (71%) create mode 100644 src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultSecret.cs rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSDeletedSecretIdentityItem.cs => PSDeletedKeyVaultSecretIdentityItem.cs} (71%) delete mode 100644 src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecret.cs rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSVault.cs => PSKeyVault.cs} (91%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSVaultAccessPolicy.cs => PSKeyVaultAccessPolicy.cs} (90%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSCertificateIdentityItem.cs => PSKeyVaultCertificateIdentityItem.cs} (87%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSCertificateIssuerIdentityItem.cs => PSKeyVaultCertificateIssuerIdentityItem.cs} (79%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSVaultIdentityItem.cs => PSKeyVaultIdentityItem.cs} (92%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSKeyBundle.cs => PSKeyVaultKey.cs} (71%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSKeyAttributes.cs => PSKeyVaultKeyAttributes.cs} (90%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSKeyIdentityItem.cs => PSKeyVaultKeyIdentityItem.cs} (84%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSSecret.cs => PSKeyVaultSecret.cs} (74%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSSecretAttributes.cs => PSKeyVaultSecretAttributes.cs} (89%) rename src/ResourceManager/KeyVault/Commands.KeyVault/Models/{PSSecretIdentityItem.cs => PSKeyVaultSecretIdentityItem.cs} (86%) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs index 5f963458da54..2ed673eda738 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultKeyTests.cs @@ -24,9 +24,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests public class RemoveKeyVaultKeyTests : KeyVaultUnitTestBase { private RemoveAzureKeyVaultKey cmdlet; - private PSKeyAttributes keyAttributes; + private PSKeyVaultKeyAttributes keyAttributes; private WebKey.JsonWebKey webKey; - private PSDeletedKeyBundle keyBundle; + private PSDeletedKeyVaultKey keyBundle; public RemoveKeyVaultKeyTests() { @@ -39,16 +39,16 @@ public RemoveKeyVaultKeyTests() VaultName = VaultName }; - keyAttributes = new PSKeyAttributes(true, DateTime.Now, DateTime.Now, "HSM", new string[] { "All" }, null); + keyAttributes = new PSKeyVaultKeyAttributes(true, DateTime.Now, DateTime.Now, "HSM", new string[] { "All" }, null); webKey = new WebKey.JsonWebKey(); - keyBundle = new PSDeletedKeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName }; + keyBundle = new PSDeletedKeyVaultKey() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName }; } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void CanRemoveKeyWithPassThruTest() { - PSDeletedKeyBundle expected = keyBundle; + PSDeletedKeyVaultKey expected = keyBundle; keyVaultClientMock.Setup(kv => kv.DeleteKey(VaultName, KeyName)).Returns(expected).Verifiable(); // Mock the should process to return true @@ -67,7 +67,7 @@ public void CanRemoveKeyWithPassThruTest() [Trait(Category.AcceptanceType, Category.CheckIn)] public void CanRemoveKeyWithNoPassThruTest() { - PSDeletedKeyBundle expected = keyBundle; + PSDeletedKeyVaultKey expected = keyBundle; keyVaultClientMock.Setup(kv => kv.DeleteKey(VaultName, KeyName)).Returns(expected).Verifiable(); // Mock the should process to return true @@ -89,7 +89,7 @@ public void CannotRemoveKeyWithoutShouldProcessOrForceConfirmationTest() // Should process but without force commandRuntimeMock.Setup(cr => cr.ShouldProcess(KeyName, It.IsAny())).Returns(true); - PSKeyBundle expected = null; + PSKeyVaultKey expected = null; cmdlet.Name = KeyName; cmdlet.PassThru = true; @@ -121,7 +121,7 @@ public void ErrorRemoveKeyWithPassThruTest() catch { } keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultSecretTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultSecretTests.cs index b7cea2b17d5f..81c5de90b7c8 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultSecretTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/RemoveKeyVaultSecretTests.cs @@ -42,7 +42,7 @@ public RemoveKeyVaultSecretTests() public void CanRemoveSecretWithPassThruTest() { SecureString secureSecretValue = SecretValue.ConvertToSecureString(); - PSDeletedSecret expected = new PSDeletedSecret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue }; + PSDeletedKeyVaultSecret expected = new PSDeletedKeyVaultSecret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue }; keyVaultClientMock.Setup(kv => kv.DeleteSecret(VaultName, SecretName)).Returns(expected).Verifiable(); // Mock the should process to return true @@ -71,7 +71,7 @@ public void CanRemoveSecretWithPassThruTest() public void CanRemoveSecretWithNoPassThruTest() { SecureString secureSecretValue = SecretValue.ConvertToSecureString(); - PSDeletedSecret expected = new PSDeletedSecret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue }; + PSDeletedKeyVaultSecret expected = new PSDeletedKeyVaultSecret() { Name = SecretName, VaultName = VaultName, SecretValue = secureSecretValue }; keyVaultClientMock.Setup(kv => kv.DeleteSecret(VaultName, SecretName)).Returns(expected).Verifiable(); // Mock the should process to return true @@ -93,7 +93,7 @@ public void CannotRemoveSecretWithoutShouldProcessOrForceConfirmationTest() // Should process but without force commandRuntimeMock.Setup(cr => cr.ShouldProcess(SecretName, It.IsAny())).Returns(true); - PSSecret expected = null; + PSKeyVaultSecret expected = null; cmdlet.Name = SecretName; cmdlet.PassThru = true; @@ -125,7 +125,7 @@ public void ErrorRemoveSecretWithPassThruTest() catch { } keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs index ad6395b7d185..d2bbb4ae4598 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultKeyAttributeTests.cs @@ -24,17 +24,17 @@ namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests public class SetKeyVaultKeyAttributeTests : KeyVaultUnitTestBase { private SetAzureKeyVaultKeyAttribute cmdlet; - private PSKeyAttributes keyAttributes; + private PSKeyVaultKeyAttributes keyAttributes; private WebKey.JsonWebKey webKey; - private PSKeyBundle keyBundle; + private PSKeyVaultKey keyBundle; public SetKeyVaultKeyAttributeTests() { base.SetupTest(); - keyAttributes = new PSKeyAttributes(true, DateTime.Now, DateTime.Now, null, null, null); + keyAttributes = new PSKeyVaultKeyAttributes(true, DateTime.Now, DateTime.Now, null, null, null); webKey = new WebKey.JsonWebKey(); - keyBundle = new PSKeyBundle() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName, Version = KeyVersion }; + keyBundle = new PSKeyVaultKey() { Attributes = keyAttributes, Key = webKey, Name = KeyName, VaultName = VaultName, Version = KeyVersion }; cmdlet = new SetAzureKeyVaultKeyAttribute() { @@ -56,9 +56,9 @@ public void CanSetKeyAttributeTest() // Mock the should process to return true commandRuntimeMock.Setup(cr => cr.ShouldProcess(KeyName, It.IsAny())).Returns(true); - PSKeyBundle expected = keyBundle; + PSKeyVaultKey expected = keyBundle; keyVaultClientMock.Setup(kv => kv.UpdateKey(VaultName, KeyName, string.Empty, - It.Is(kt => kt.Enabled == keyAttributes.Enabled + It.Is(kt => kt.Enabled == keyAttributes.Enabled && kt.Expires == keyAttributes.Expires && kt.NotBefore == keyAttributes.NotBefore && kt.KeyType == keyAttributes.KeyType @@ -79,9 +79,9 @@ public void ErrorSetKeyTest() // Mock the should process to return true commandRuntimeMock.Setup(cr => cr.ShouldProcess(KeyName, It.IsAny())).Returns(true); - PSKeyBundle expected = keyBundle; + PSKeyVaultKey expected = keyBundle; keyVaultClientMock.Setup(kv => kv.UpdateKey(VaultName, KeyName, string.Empty, - It.Is(kt => kt.Enabled == keyAttributes.Enabled + It.Is(kt => kt.Enabled == keyAttributes.Enabled && kt.Expires == keyAttributes.Expires && kt.NotBefore == keyAttributes.NotBefore && kt.KeyType == keyAttributes.KeyType @@ -96,7 +96,7 @@ public void ErrorSetKeyTest() // Assert keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs index 8ec47690c5ba..3977bb4933c2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretAttributeTests.cs @@ -25,14 +25,14 @@ namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests public class SetKeyVaultSecretAttributeTests : KeyVaultUnitTestBase { private SetAzureKeyVaultSecretAttribute cmdlet; - private PSSecretAttributes secretAttributes; - private PSSecret secret; + private PSKeyVaultSecretAttributes secretAttributes; + private PSKeyVaultSecret secret; public SetKeyVaultSecretAttributeTests() { base.SetupTest(); - secretAttributes = new PSSecretAttributes(true, DateTime.UtcNow.AddYears(2), DateTime.UtcNow, "contenttype", null); - secret = new PSSecret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = null, Attributes = secretAttributes }; + secretAttributes = new PSKeyVaultSecretAttributes(true, DateTime.UtcNow.AddYears(2), DateTime.UtcNow, "contenttype", null); + secret = new PSKeyVaultSecret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = null, Attributes = secretAttributes }; cmdlet = new SetAzureKeyVaultSecretAttribute() { @@ -57,9 +57,9 @@ public void CanSetSecretAttributeTest() // Mock the should process to return true commandRuntimeMock.Setup(cr => cr.ShouldProcess(SecretName, It.IsAny())).Returns(true); - PSSecret expected = secret; + PSKeyVaultSecret expected = secret; keyVaultClientMock.Setup(kv => kv.UpdateSecret(VaultName, SecretName, SecretVersion, - It.Is(st => st.Enabled == secretAttributes.Enabled + It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires && st.NotBefore == secretAttributes.NotBefore && st.ContentType == secretAttributes.ContentType @@ -80,7 +80,7 @@ public void ErrorSetSecretAttributeTest() commandRuntimeMock.Setup(cr => cr.ShouldProcess(SecretName, It.IsAny())).Returns(true); keyVaultClientMock.Setup(kv => kv.UpdateSecret(VaultName, SecretName, SecretVersion, - It.Is(st => st.Enabled == secretAttributes.Enabled + It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires && st.NotBefore == secretAttributes.NotBefore && st.ContentType == secretAttributes.ContentType @@ -94,7 +94,7 @@ public void ErrorSetSecretAttributeTest() catch { } keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs index 4cc43c81e1cf..5c640c352139 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault.Test/UnitTests/SetKeyVaultSecretTests.cs @@ -25,17 +25,17 @@ namespace Microsoft.Azure.Commands.KeyVault.Test.UnitTests public class SetKeyVaultSecretTests : KeyVaultUnitTestBase { private SetAzureKeyVaultSecret cmdlet; - private PSSecretAttributes secretAttributes; + private PSKeyVaultSecretAttributes secretAttributes; private SecureString secureSecretValue; - private PSSecret secret; + private PSKeyVaultSecret secret; public SetKeyVaultSecretTests() { base.SetupTest(); - secretAttributes = new PSSecretAttributes(true, null, null, null, null); + secretAttributes = new PSKeyVaultSecretAttributes(true, null, null, null, null); secureSecretValue = SecretValue.ConvertToSecureString(); - secret = new PSSecret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = secureSecretValue, Attributes = secretAttributes }; + secret = new PSKeyVaultSecret() { VaultName = VaultName, Name = SecretName, Version = SecretVersion, SecretValue = secureSecretValue, Attributes = secretAttributes }; cmdlet = new SetAzureKeyVaultSecret() { @@ -56,9 +56,9 @@ public SetKeyVaultSecretTests() [Trait(Category.AcceptanceType, Category.CheckIn)] public void CanSetSecretTest() { - PSSecret expected = secret; + PSKeyVaultSecret expected = secret; keyVaultClientMock.Setup(kv => kv.SetSecret(VaultName, SecretName, secureSecretValue, - It.Is(st => st.Enabled == secretAttributes.Enabled + It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires && st.NotBefore == secretAttributes.NotBefore && st.ContentType == secretAttributes.ContentType @@ -82,7 +82,7 @@ public void ErrorSetSecretTest() commandRuntimeMock.Setup(cr => cr.ShouldProcess(SecretName, It.IsAny())).Returns(true); keyVaultClientMock.Setup(kv => kv.SetSecret(VaultName, SecretName, secureSecretValue, - It.Is(st => st.Enabled == secretAttributes.Enabled + It.Is(st => st.Enabled == secretAttributes.Enabled && st.Expires == secretAttributes.Expires && st.NotBefore == secretAttributes.NotBefore && st.ContentType == secretAttributes.ContentType @@ -96,7 +96,7 @@ public void ErrorSetSecretTest() catch { } keyVaultClientMock.VerifyAll(); - commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); + commandRuntimeMock.Verify(f => f.WriteObject(It.IsAny()), Times.Never()); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj index fb1c03acb44b..26d3eb3c8cf4 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands.KeyVault.csproj @@ -93,16 +93,16 @@ - + - - + + - - - - - + + + + + @@ -119,10 +119,10 @@ - - + + - + @@ -157,16 +157,16 @@ - - - + + + - - - + + + diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs index 503ff40d0340..bd48ab8591ca 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs @@ -61,7 +61,7 @@ public class AddAzureKeyVaultCertificateContact : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "KeyVault object.")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// VaultId diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs index 9f82d1267f0a..6f7b7dce5e09 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultKey.cs @@ -37,7 +37,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = InteractiveCreateParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSKeyBundle))] + [OutputType(typeof(PSKeyVaultKey))] public class AddAzureKeyVaultKey : KeyVaultCmdletBase { @@ -82,7 +82,7 @@ public class AddAzureKeyVaultKey : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Vault object.")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// key name @@ -186,7 +186,7 @@ public override void ExecuteCmdlet() { if (ShouldProcess(Name, Properties.Resources.AddKey)) { - PSKeyBundle keyBundle; + PSKeyVaultKey keyBundle; if (InputObject != null) { VaultName = InputObject.VaultName.ToString(); @@ -213,7 +213,7 @@ public override void ExecuteCmdlet() } } - internal PSKeyAttributes CreateKeyAttributes() + internal PSKeyVaultKeyAttributes CreateKeyAttributes() { string keyType = string.Empty; @@ -222,7 +222,7 @@ internal PSKeyAttributes CreateKeyAttributes() keyType = (HsmDestination.Equals(Destination, StringComparison.OrdinalIgnoreCase)) ? JsonWebKeyType.RsaHsm : JsonWebKeyType.Rsa; } - return new Models.PSKeyAttributes( + return new Models.PSKeyVaultKeyAttributes( !Disable.IsPresent, Expires, NotBefore, diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs index cdb9fa52d8f7..b7cf07ab2787 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs @@ -80,7 +80,7 @@ public class BackupAzureKeyVaultKey : KeyVaultCmdletBase HelpMessage = "Key bundle to back up, pipelined in from the output of a retrieval call.")] [ValidateNotNullOrEmpty] [Alias("Key")] - public PSKeyBundle InputObject { get; set; } + public PSKeyVaultKeyIdentityItem InputObject { get; set; } /// /// The output file in which the backup blob is to be stored diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs index 190173afd950..3734cfefd874 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs @@ -80,7 +80,7 @@ public class BackupAzureKeyVaultSecret : KeyVaultCmdletBase HelpMessage = "Secret to be backed up, pipelined in from the output of a retrieval call.")] [ValidateNotNullOrEmpty] [Alias("Secret")] - public PSSecret InputObject { get; set; } + public PSKeyVaultSecretIdentityItem InputObject { get; set; } /// /// The output file in which the backup blob is to be stored diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs index d3c39e37652d..bf8bf9939a81 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs @@ -25,8 +25,8 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, "AzureRmKeyVault", DefaultParameterSetName = ListVaultsBySubParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSVault), typeof(List), - typeof(PSDeletedVault), typeof(List))] + [OutputType(typeof(PSKeyVault), typeof(List), + typeof(PSDeletedKeyVault), typeof(List))] public class GetAzureKeyVault : KeyVaultManagementCmdletBase { #region Parameter Set Names @@ -109,7 +109,7 @@ public override void ExecuteCmdlet() { case GetVaultParameterSet: ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName; - PSVault vault = null; + PSKeyVault vault = null; if (!string.IsNullOrWhiteSpace(ResourceGroupName)) vault = KeyVaultManagementClient.GetVault( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs index 2d447d357a02..466c3d11ff64 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, CmdletNoun.AzureKeyVaultCertificate, DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List), typeof(PSKeyVaultCertificate), typeof(PSDeletedKeyVaultCertificate), typeof(List))] + [OutputType(typeof(List), typeof(PSKeyVaultCertificate), typeof(PSDeletedKeyVaultCertificate), typeof(List))] public class GetAzureKeyVaultCertificate : KeyVaultCmdletBase { #region Parameter Set Names @@ -80,7 +80,7 @@ public class GetAzureKeyVaultCertificate : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "KeyVault object.")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// Name @@ -175,7 +175,7 @@ public override void ExecuteCmdlet() certBundle = this.DataServiceClient.GetCertificate(VaultName, Name, string.Empty); if (certBundle != null) { - WriteObject(new PSCertificateIdentityItem(certBundle)); + WriteObject(new PSKeyVaultCertificateIdentityItem(certBundle)); GetAndWriteCertificatesVersions(VaultName, Name, certBundle.CertificateIdentifier.Version); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs index e187f4ae0dc6..fef3874fa5d4 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateContact.cs @@ -59,7 +59,7 @@ public class GetAzureKeyVaultCertificateContact : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "KeyVault object.")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// ResourceId diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs index ae9b69fe7e19..99284a8b8c0e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, CmdletNoun.AzureKeyVaultCertificateIssuer, DefaultParameterSetName = ByNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List), typeof(PSKeyVaultCertificateIssuer))] + [OutputType(typeof(List), typeof(PSKeyVaultCertificateIssuer))] public class GetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase { #region Parameter Set Names @@ -56,7 +56,7 @@ public class GetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "KeyVault object.")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// Name. @@ -102,7 +102,7 @@ private void GetAndWriteCertificateIssuers(string vaultName) do { var pageResults = this.DataServiceClient.GetCertificateIssuers(options); - var psPageResults = new List(); + var psPageResults = new List(); foreach (var page in pageResults) { page.VaultName = VaultName; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs index 494727f809fd..391d442b3ef0 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateOperation.cs @@ -67,7 +67,7 @@ public class GetAzureKeyVaultCertificateOperation : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Certificate Object.")] [ValidateNotNullOrEmpty] - public PSKeyVaultCertificate InputObject { get; set; } + public PSKeyVaultCertificateIdentityItem InputObject { get; set; } #endregion diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs index 8ad939374245..f22e91bd69de 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificatePolicy.cs @@ -69,7 +69,7 @@ public class GetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Certificate Object.")] [ValidateNotNullOrEmpty] - public PSKeyVaultCertificate InputObject { get; set; } + public PSKeyVaultCertificateIdentityItem InputObject { get; set; } #endregion public override void ExecuteCmdlet() diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs index f8bd09d38187..3e6558b43b96 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultKey.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, "AzureKeyVaultKey", DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List), typeof(PSKeyBundle), typeof(List), typeof(PSDeletedKeyBundle))] + [OutputType(typeof(List), typeof(PSKeyVaultKey), typeof(List), typeof(PSDeletedKeyVaultKey))] public class GetAzureKeyVaultKey : KeyVaultCmdletBase { @@ -81,7 +81,7 @@ public class GetAzureKeyVaultKey : KeyVaultCmdletBase ParameterSetName = InputObjectByKeyVersionsParameterSet, HelpMessage = "KeyVault object.")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// Key name. @@ -156,7 +156,7 @@ public class GetAzureKeyVaultKey : KeyVaultCmdletBase public override void ExecuteCmdlet() { - PSKeyBundle keyBundle; + PSKeyVaultKey keyBundle; if (InputObject != null) { @@ -173,7 +173,7 @@ public override void ExecuteCmdlet() keyBundle = DataServiceClient.GetKey(VaultName, Name, string.Empty); if (keyBundle != null) { - WriteObject(new PSKeyIdentityItem(keyBundle)); + WriteObject(new PSKeyVaultKeyIdentityItem(keyBundle)); GetAndWriteKeyVersions(VaultName, Name, keyBundle.Version); } } @@ -185,7 +185,7 @@ public override void ExecuteCmdlet() } else { - PSDeletedKeyBundle deletedKeyBundle = DataServiceClient.GetDeletedKey(VaultName, Name); + PSDeletedKeyVaultKey deletedKeyBundle = DataServiceClient.GetDeletedKey(VaultName, Name); WriteObject(deletedKeyBundle); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs index 2bf0705d08ec..a2a281e3d4ac 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultSecret.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Get, "AzureKeyVaultSecret", DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(List), typeof(PSSecret), typeof(List), typeof(PSDeletedSecret))] + [OutputType(typeof(List), typeof(PSKeyVaultSecret), typeof(List), typeof(PSDeletedKeyVaultSecret))] public class GetAzureKeyVaultSecret : KeyVaultCmdletBase { #region Parameter Set Names @@ -79,7 +79,7 @@ public class GetAzureKeyVaultSecret : KeyVaultCmdletBase ParameterSetName = InputObjectBySecretVersionsParameterSet, HelpMessage = "KeyVault Object.")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// Secret name @@ -154,7 +154,7 @@ public class GetAzureKeyVaultSecret : KeyVaultCmdletBase public override void ExecuteCmdlet() { - PSSecret secret; + PSKeyVaultSecret secret; if (InputObject != null) { @@ -171,7 +171,7 @@ public override void ExecuteCmdlet() secret = DataServiceClient.GetSecret(VaultName, Name, string.Empty); if (secret != null) { - WriteObject(new PSSecretIdentityItem(secret)); + WriteObject(new PSKeyVaultSecretIdentityItem(secret)); GetAndWriteSecretVersions(VaultName, Name, secret.Version); } } @@ -183,7 +183,7 @@ public override void ExecuteCmdlet() } else { - PSDeletedSecret deletedSecret = DataServiceClient.GetDeletedSecret(VaultName, Name); + PSDeletedKeyVaultSecret deletedSecret = DataServiceClient.GetDeletedSecret(VaultName, Name); WriteObject(deletedSecret); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVault.cs index dc34bfa9086a..1dffc00c4004 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVault.cs @@ -28,7 +28,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.New, "AzureRmKeyVault", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSVault))] + [OutputType(typeof(PSKeyVault))] public class NewAzureKeyVault : KeyVaultManagementCmdletBase { #region Input Parameter Definitions diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs index 67846102b6c8..765405a584f0 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs @@ -26,6 +26,7 @@ namespace Microsoft.Azure.Commands.KeyVault DefaultParameterSetName = RemoveVaultParameterSet, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] + [OutputType(typeof(bool))] public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase { #region Parameter Set Names @@ -70,7 +71,7 @@ public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase ValueFromPipeline = true, HelpMessage = "Key Vault object to be deleted.")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// Resource group to which the vault belongs. @@ -129,6 +130,10 @@ public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] public SwitchParameter AsJob { get; set; } + [Parameter(Mandatory = false, + HelpMessage = "This Cmdlet does not return an object by default. If this switch is specified, it returns true if successful.")] + public SwitchParameter PassThru { get; set; } + #endregion public override void ExecuteCmdlet() @@ -157,6 +162,11 @@ public override void ExecuteCmdlet() KeyVaultManagementClient.PurgeVault( vaultName: VaultName, location: Location); + + if (PassThru) + { + WriteObject(true); + } }); } else @@ -180,6 +190,11 @@ public override void ExecuteCmdlet() KeyVaultManagementClient.DeleteVault( vaultName: VaultName, resourceGroupName: this.ResourceGroupName); + + if (PassThru) + { + WriteObject(true); + } }); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs index e95d5221df78..72fa9b962c8a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = ByUserPrincipalName, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSVault))] + [OutputType(typeof(PSKeyVault))] public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase { #region Parameter Set Names @@ -138,7 +138,7 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ValueFromPipeline = true, HelpMessage = "Key Vault object.")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// Service principal name @@ -267,7 +267,7 @@ public override void ExecuteCmdlet() ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName; // Get the vault to be updated - PSVault existingVault = null; + PSKeyVault existingVault = null; if (!string.IsNullOrWhiteSpace(ResourceGroupName)) existingVault = KeyVaultManagementClient.GetVault( @@ -311,7 +311,7 @@ public override void ExecuteCmdlet() WriteObject(updatedVault); } } - private bool ShallBeRemoved(PSVaultAccessPolicy ap, string objectId, Guid? applicationId) + private bool ShallBeRemoved(PSKeyVaultAccessPolicy ap, string objectId, Guid? applicationId) { // If both object id and application id are specified, remove the compound identity policy only. // If only object id is specified, remove all policies refer to the object id including the compound identity policies. diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs index e3c0b9921aff..a180addf0fb7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificate.cs @@ -70,7 +70,7 @@ public class RemoveAzureKeyVaultCertificate : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Certificate Object.")] [ValidateNotNullOrEmpty] - public PSKeyVaultCertificate InputObject { get; set; } + public PSKeyVaultCertificateIdentityItem InputObject { get; set; } /// /// If present, operate on the deleted key entity. diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs index 0518565120ea..24e99cc94746 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateIssuer.cs @@ -67,7 +67,7 @@ public class RemoveAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Certificate Issuer Object")] [ValidateNotNullOrEmpty] - public PSKeyVaultCertificateIssuer InputObject { get; set; } + public PSKeyVaultCertificateIssuerIdentityItem InputObject { get; set; } /// /// If present, do not ask for confirmation diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs index 83f9d0b2aef9..6b0a1ebaa3c2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultKey.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault DefaultParameterSetName = ByVaultNameParameterSet, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSDeletedKeyBundle))] + [OutputType(typeof(PSDeletedKeyVaultKey))] public class RemoveAzureKeyVaultKey : KeyVaultCmdletBase { #region Parameter Set Names @@ -68,7 +68,7 @@ public class RemoveAzureKeyVaultKey : KeyVaultCmdletBase ParameterSetName = ByInputObjectParameterSet, HelpMessage = "KeyBundle Object")] [ValidateNotNullOrEmpty] - public PSKeyBundle InputObject { get; set; } + public PSKeyVaultKeyIdentityItem InputObject { get; set; } /// /// If present, do not ask for confirmation @@ -114,7 +114,7 @@ public override void ExecuteCmdlet() return; } - PSDeletedKeyBundle deletedKeyBundle = null; + PSDeletedKeyVaultKey deletedKeyBundle = null; ConfirmAction( Force.IsPresent, string.Format( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs index 534c99ddf97f..a08d8ccce0a2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultSecret.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault DefaultParameterSetName = ByVaultNameParameterSet, ConfirmImpact = ConfirmImpact.High, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSDeletedSecret))] + [OutputType(typeof(PSDeletedKeyVaultSecret))] public class RemoveAzureKeyVaultSecret : KeyVaultCmdletBase { #region Parameter Set Names @@ -68,7 +68,7 @@ public class RemoveAzureKeyVaultSecret : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Key Vault Secret Object")] [ValidateNotNullOrEmpty] - public PSSecret InputObject { get; set; } + public PSKeyVaultSecretIdentityItem InputObject { get; set; } /// /// If present, do not ask for confirmation @@ -115,7 +115,7 @@ public override void ExecuteCmdlet() return; } - PSDeletedSecret deletedSecret = null; + PSDeletedKeyVaultSecret deletedSecret = null; ConfirmAction( Force.IsPresent, string.Format( diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs index eeffc40d8904..accd35acaee4 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs @@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSKeyBundle))] + [OutputType(typeof(PSKeyVaultKey))] public class RestoreAzureKeyVaultKey : KeyVaultCmdletBase { #region Parameter Set Names @@ -58,7 +58,7 @@ public class RestoreAzureKeyVaultKey : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "KeyVault object")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// The input file in which the backup blob is stored diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs index 56dfd19f1e77..bf8ec17e5383 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs @@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = ByVaultNameParameterSet, HelpUri = Constants.KeyVaultHelpUri )] - [OutputType( typeof(PSSecret) )] + [OutputType( typeof(PSKeyVaultSecret) )] public class RestoreAzureKeyVaultSecret : KeyVaultCmdletBase { #region Parameter Set Names @@ -59,7 +59,7 @@ public class RestoreAzureKeyVaultSecret : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "KeyVault object")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// The input file in which the backup blob is stored diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultAccessPolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultAccessPolicy.cs index b729da4afe8d..ec3fe00e43bf 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultAccessPolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultAccessPolicy.cs @@ -29,7 +29,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = ByUserPrincipalName, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSVault))] + [OutputType(typeof(PSKeyVault))] public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase { private readonly string[] SecretAllExpansion = { @@ -199,7 +199,7 @@ public class SetAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = InputObjectForVault, HelpMessage = "Key Vault Object")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// Service principal name @@ -489,7 +489,7 @@ public override void ExecuteCmdlet() } ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName; - PSVault vault = null; + PSKeyVault vault = null; // Get the vault to be updated if (!string.IsNullOrWhiteSpace(ResourceGroupName)) @@ -507,7 +507,7 @@ public override void ExecuteCmdlet() } // Update vault policies - PSVaultAccessPolicy[] updatedListOfAccessPolicies = vault.AccessPolicies; + PSKeyVaultAccessPolicy[] updatedListOfAccessPolicies = vault.AccessPolicies; if (!string.IsNullOrEmpty(UserPrincipalName) || !string.IsNullOrEmpty(ServicePrincipalName) || !string.IsNullOrWhiteSpace(this.ObjectId) @@ -561,7 +561,7 @@ public override void ExecuteCmdlet() updatedListOfAccessPolicies = vault.AccessPolicies.Where(ap => !MatchVaultAccessPolicyIdentity(ap, objId, this.ApplicationId)).ToArray(); if ( ( keys != null && keys.Length > 0 ) || ( secrets != null && secrets.Length > 0 ) || ( certificates != null && certificates.Length > 0 ) || ( managedStorage != null && managedStorage.Length > 0 ) ) { - var policy = new PSVaultAccessPolicy( vault.TenantId, objId, this.ApplicationId, keys, secrets, certificates, managedStorage ); + var policy = new PSKeyVaultAccessPolicy( vault.TenantId, objId, this.ApplicationId, keys, secrets, certificates, managedStorage ); updatedListOfAccessPolicies = updatedListOfAccessPolicies.Concat(new[] { policy }).ToArray(); } @@ -604,7 +604,7 @@ private string[] ExpandPermissionSet(string[] permissions, string[] allExpansion }).Distinct(StringComparer.OrdinalIgnoreCase).ToArray(); // Allow "all" + other perms, but after the expansion, only allow distinct values. } - private bool MatchVaultAccessPolicyIdentity(PSVaultAccessPolicy ap, string objectId, Guid? applicationId) + private bool MatchVaultAccessPolicyIdentity(PSKeyVaultAccessPolicy ap, string objectId, Guid? applicationId) { return ap.ApplicationId == applicationId && string.Equals(ap.ObjectId, objectId, StringComparison.OrdinalIgnoreCase); } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs index 9cf6e40522d7..06e1e6311423 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateAttribute.cs @@ -67,7 +67,7 @@ public class SetAzureKeyVaultCertificateAttribute : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Certificate object")] [ValidateNotNullOrEmpty] - public PSKeyVaultCertificate InputObject { get; set; } + public PSKeyVaultCertificateIdentityItem InputObject { get; set; } /// /// Certificate version. diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs index 18f4c25c57b2..e8d8763102ef 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs @@ -73,7 +73,7 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Key Vault Object")] [ValidateNotNullOrEmpty] - public PSVault InputObject { get; set; } + public PSKeyVault InputObject { get; set; } /// /// Name @@ -153,7 +153,7 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the certificate issuer to set.")] [ValidateNotNullOrEmpty] - public PSKeyVaultCertificateIssuer Issuer { get; set; } + public PSKeyVaultCertificateIssuerIdentityItem Issuer { get; set; } #endregion @@ -178,7 +178,7 @@ public override void ExecuteCmdlet() if (Issuer != null) { - issuerToUse = Issuer; + issuerToUse = (PSKeyVaultCertificateIssuer) Issuer; } else { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs index 31d2447fb9ea..f9accad1fd8e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultKeyAttribute.cs @@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = DefaultParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSKeyBundle))] + [OutputType(typeof(PSKeyVaultKey))] public class SetAzureKeyVaultKeyAttribute : KeyVaultCmdletBase { #region Parameter Set Names @@ -71,7 +71,7 @@ public class SetAzureKeyVaultKeyAttribute : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Key object")] [ValidateNotNullOrEmpty] - public PSKeyBundle InputObject { get; set; } + public PSKeyVaultKeyIdentityItem InputObject { get; set; } /// /// Key version. @@ -142,7 +142,7 @@ public override void ExecuteCmdlet() VaultName, Name, Version ?? string.Empty, - new PSKeyAttributes(Enable, Expires, NotBefore, null, KeyOps, Tag)); + new PSKeyVaultKeyAttributes(Enable, Expires, NotBefore, null, KeyOps, Tag)); if (PassThru) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs index 1a767f5251c2..ac47cfce70dc 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecret.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = DefaultParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSSecret))] + [OutputType(typeof(PSKeyVaultSecret))] public class SetAzureKeyVaultSecret : KeyVaultCmdletBase { #region Parameter Set Names @@ -68,7 +68,7 @@ public class SetAzureKeyVaultSecret : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Secret object")] [ValidateNotNullOrEmpty] - public PSSecret InputObject { get; set; } + public PSKeyVaultSecretIdentityItem InputObject { get; set; } /// /// Secret value @@ -134,7 +134,7 @@ public override void ExecuteCmdlet() VaultName, Name, SecretValue, - new PSSecretAttributes(!Disable.IsPresent, Expires, NotBefore, ContentType, Tag)); + new PSKeyVaultSecretAttributes(!Disable.IsPresent, Expires, NotBefore, ContentType, Tag)); WriteObject(secret); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs index 1e7c891e71bf..c199331b0089 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.KeyVault [Cmdlet(VerbsCommon.Set, "AzureKeyVaultSecretAttribute", SupportsShouldProcess = true, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSSecret))] + [OutputType(typeof(PSKeyVaultSecret))] public class SetAzureKeyVaultSecretAttribute : KeyVaultCmdletBase { #region Parameter Set Names @@ -66,7 +66,7 @@ public class SetAzureKeyVaultSecretAttribute : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Secret object")] [ValidateNotNullOrEmpty] - public PSSecret InputObject { get; set; } + public PSKeyVaultSecretIdentityItem InputObject { get; set; } /// /// Key version. @@ -141,7 +141,7 @@ public override void ExecuteCmdlet() VaultName, Name, Version ?? string.Empty, - new PSSecretAttributes(Enable, Expires, NotBefore, ContentType, Tag)); + new PSKeyVaultSecretAttributes(Enable, Expires, NotBefore, ContentType, Tag)); if (PassThru) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultCertificateRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultCertificateRemoval.cs index e881c23cacee..bc032005fb36 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultCertificateRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultCertificateRemoval.cs @@ -66,7 +66,7 @@ public class UndoAzureKeyVaultCertificateRemoval : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Deleted Certificate object")] [ValidateNotNullOrEmpty] - public PSDeletedKeyVaultCertificate InputObject { get; set; } + public PSDeletedKeyVaultCertificateIdentityItem InputObject { get; set; } #endregion diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs index 49edd8563444..80391f264fe6 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultKeyRemoval.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = DefaultParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSKeyBundle))] + [OutputType(typeof(PSKeyVaultKey))] public class UndoAzureKeyVaultKeyRemoval : KeyVaultCmdletBase { #region Parameter Set Names @@ -65,7 +65,7 @@ public class UndoAzureKeyVaultKeyRemoval : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Deleted key object")] [ValidateNotNullOrEmpty] - public PSDeletedKeyBundle InputObject { get; set; } + public PSDeletedKeyVaultKeyIdentityItem InputObject { get; set; } #endregion @@ -79,7 +79,7 @@ public override void ExecuteCmdlet() if (ShouldProcess(Name, Properties.Resources.RecoverKey)) { - PSKeyBundle recoveredKey = DataServiceClient.RecoverKey(VaultName, Name); + PSKeyVaultKey recoveredKey = DataServiceClient.RecoverKey(VaultName, Name); WriteObject(recoveredKey); } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultRemoval.cs index af1a6a4625df..703b62946d36 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultRemoval.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = DefaultParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSVault))] + [OutputType(typeof(PSKeyVault))] public class UndoAzureKeyVaultRemoval : KeyVaultManagementCmdletBase { #region Parameter Set Names @@ -56,7 +56,7 @@ public class UndoAzureKeyVaultRemoval : KeyVaultManagementCmdletBase ValueFromPipeline = true, HelpMessage = "Deleted vault object")] [ValidateNotNullOrEmpty] - public PSDeletedVault InputObject { get; set; } + public PSDeletedKeyVault InputObject { get; set; } /// /// Resource group name diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs index 3c952659cb1d..0f14716381b7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultSecretRemoval.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Commands.KeyVault SupportsShouldProcess = true, DefaultParameterSetName = DefaultParameterSet, HelpUri = Constants.KeyVaultHelpUri)] - [OutputType(typeof(PSSecret))] + [OutputType(typeof(PSKeyVaultSecret))] public class UndoAzureKeyVaultSecretRemoval : KeyVaultCmdletBase { #region Parameter Set Names @@ -65,7 +65,7 @@ public class UndoAzureKeyVaultSecretRemoval : KeyVaultCmdletBase ValueFromPipeline = true, HelpMessage = "Deleted secret object")] [ValidateNotNullOrEmpty] - public PSDeletedSecret InputObject { get; set; } + public PSDeletedKeyVaultSecretIdentityItem InputObject { get; set; } #endregion @@ -79,7 +79,7 @@ public override void ExecuteCmdlet() if (ShouldProcess(Name, Properties.Resources.RecoverSecret)) { - PSSecret secret = DataServiceClient.RecoverSecret(VaultName, Name); + PSKeyVaultSecret secret = DataServiceClient.RecoverSecret(VaultName, Name); WriteObject(secret); } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Microsoft.Azure.Commands.KeyVault.format.ps1xml b/src/ResourceManager/KeyVault/Commands.KeyVault/Microsoft.Azure.Commands.KeyVault.format.ps1xml index 96ae8d320c7e..c0eb59b11697 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Microsoft.Azure.Commands.KeyVault.format.ps1xml +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Microsoft.Azure.Commands.KeyVault.format.ps1xml @@ -2,9 +2,9 @@ - Microsoft.Azure.Commands.KeyVault.Models.KeyIdentityItem + Microsoft.Azure.Commands.KeyVault.Models.PSKeyIdentityItem - Microsoft.Azure.Commands.KeyVault.Models.KeyIdentityItem + Microsoft.Azure.Commands.KeyVault.Models.PSKeyIdentityItem @@ -60,9 +60,9 @@ - Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyIdentityItem + Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyIdentityItem - Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyIdentityItem + Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyIdentityItem @@ -122,9 +122,9 @@ - Microsoft.Azure.Commands.KeyVault.Models.SecretIdentityItem + Microsoft.Azure.Commands.KeyVault.Models.PSSecretIdentityItem - Microsoft.Azure.Commands.KeyVault.Models.SecretIdentityItem + Microsoft.Azure.Commands.KeyVault.Models.PSSecretIdentityItem @@ -180,9 +180,9 @@ - Microsoft.Azure.Commands.KeyVault.Models.DeletedSecretIdentityItem + Microsoft.Azure.Commands.KeyVault.Models.PSDeletedSecretIdentityItem - Microsoft.Azure.Commands.KeyVault.Models.DeletedSecretIdentityItem + Microsoft.Azure.Commands.KeyVault.Models.PSDeletedSecretIdentityItem @@ -430,9 +430,9 @@ - Microsoft.Azure.Commands.KeyVault.Models.Secret + Microsoft.Azure.Commands.KeyVault.Models.PSSecret - Microsoft.Azure.Commands.KeyVault.Models.Secret + Microsoft.Azure.Commands.KeyVault.Models.PSSecret @@ -551,9 +551,9 @@ - Microsoft.Azure.Commands.KeyVault.Models.DeletedSecret + Microsoft.Azure.Commands.KeyVault.Models.PSDeletedSecret - Microsoft.Azure.Commands.KeyVault.Models.DeletedSecret + Microsoft.Azure.Commands.KeyVault.Models.PSDeletedSecret diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs index f916cfbb8da3..0a294302aa4c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/IKeyVaultDataServiceClient.cs @@ -24,55 +24,55 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { public interface IKeyVaultDataServiceClient { - PSKeyBundle CreateKey(string vaultName, string keyName, PSKeyAttributes keyAttributes); + PSKeyVaultKey CreateKey(string vaultName, string keyName, PSKeyVaultKeyAttributes keyAttributes); - PSKeyBundle ImportKey(string vaultName, string keyName, PSKeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm); + PSKeyVaultKey ImportKey(string vaultName, string keyName, PSKeyVaultKeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm); - PSKeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, PSKeyAttributes keyAttributes); + PSKeyVaultKey UpdateKey(string vaultName, string keyName, string keyVersion, PSKeyVaultKeyAttributes keyAttributes); - PSKeyBundle GetKey(string vaultName, string keyName, string keyVersion); + PSKeyVaultKey GetKey(string vaultName, string keyName, string keyVersion); - PSDeletedKeyBundle GetDeletedKey(string vaultName, string name); + PSDeletedKeyVaultKey GetDeletedKey(string vaultName, string name); - IEnumerable GetKeys(KeyVaultObjectFilterOptions options); + IEnumerable GetKeys(KeyVaultObjectFilterOptions options); - IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions options); + IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions options); - IEnumerable GetDeletedKeys(KeyVaultObjectFilterOptions options); + IEnumerable GetDeletedKeys(KeyVaultObjectFilterOptions options); - PSDeletedKeyBundle DeleteKey(string vaultName, string keyName); + PSDeletedKeyVaultKey DeleteKey(string vaultName, string keyName); void PurgeKey(string vaultName, string name); - PSKeyBundle RecoverKey(string vaultName, string keyName); + PSKeyVaultKey RecoverKey(string vaultName, string keyName); - PSSecret SetSecret(string vaultName, string secretName, SecureString secretValue, PSSecretAttributes secretAttributes); + PSKeyVaultSecret SetSecret(string vaultName, string secretName, SecureString secretValue, PSKeyVaultSecretAttributes secretAttributes); - PSSecret UpdateSecret(string vaultName, string secretName, string secretVersion, PSSecretAttributes secretAttributes); + PSKeyVaultSecret UpdateSecret(string vaultName, string secretName, string secretVersion, PSKeyVaultSecretAttributes secretAttributes); - PSSecret GetSecret(string vaultName, string secretName, string secretVersion); + PSKeyVaultSecret GetSecret(string vaultName, string secretName, string secretVersion); - PSDeletedSecret GetDeletedSecret(string vaultName, string name); + PSDeletedKeyVaultSecret GetDeletedSecret(string vaultName, string name); - IEnumerable GetSecrets(KeyVaultObjectFilterOptions options); + IEnumerable GetSecrets(KeyVaultObjectFilterOptions options); - IEnumerable GetSecretVersions(KeyVaultObjectFilterOptions options); + IEnumerable GetSecretVersions(KeyVaultObjectFilterOptions options); - IEnumerable GetDeletedSecrets(KeyVaultObjectFilterOptions options); + IEnumerable GetDeletedSecrets(KeyVaultObjectFilterOptions options); - PSDeletedSecret DeleteSecret(string vaultName, string secretName); + PSDeletedKeyVaultSecret DeleteSecret(string vaultName, string secretName); void PurgeSecret(string vaultName, string secretName); - PSSecret RecoverSecret(string vaultName, string secretName); + PSKeyVaultSecret RecoverSecret(string vaultName, string secretName); string BackupKey(string vaultName, string keyName, string outputBlobPath); - PSKeyBundle RestoreKey(string vaultName, string inputBlobPath); + PSKeyVaultKey RestoreKey(string vaultName, string inputBlobPath); string BackupSecret(string vaultName, string secretName, string outputBlobPath); - PSSecret RestoreSecret(string vaultName, string inputBlobPath); + PSKeyVaultSecret RestoreSecret(string vaultName, string inputBlobPath); #region Certificate actions @@ -84,11 +84,11 @@ public interface IKeyVaultDataServiceClient DeletedCertificateBundle GetDeletedCertificate( string vaultName, string certName ); - IEnumerable GetCertificates(KeyVaultObjectFilterOptions options); + IEnumerable GetCertificates(KeyVaultObjectFilterOptions options); - IEnumerable GetDeletedCertificates( KeyVaultObjectFilterOptions options ); + IEnumerable GetDeletedCertificates( KeyVaultObjectFilterOptions options ); - IEnumerable GetCertificateVersions(KeyVaultObjectFilterOptions options); + IEnumerable GetCertificateVersions(KeyVaultObjectFilterOptions options); CertificateBundle MergeCertificate(string vaultName, string certName, X509Certificate2Collection certs, IDictionary tags); @@ -118,7 +118,7 @@ public interface IKeyVaultDataServiceClient IssuerBundle GetCertificateIssuer(string vaultName, string issuerName); - IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options); + IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options); IssuerBundle SetCertificateIssuer(string vaultName, string issuerName, string issuerProvider, string accountId, SecureString apiKey, PSKeyVaultCertificateOrganizationDetails organizationDetails); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs index bffecde35fd6..9812d8c65c28 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultDataServiceClient.cs @@ -58,7 +58,7 @@ public KeyVaultDataServiceClient() { } - public PSKeyBundle CreateKey(string vaultName, string keyName, PSKeyAttributes keyAttributes) + public PSKeyVaultKey CreateKey(string vaultName, string keyName, PSKeyVaultKeyAttributes keyAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -86,7 +86,7 @@ public PSKeyBundle CreateKey(string vaultName, string keyName, PSKeyAttributes k throw GetInnerException(ex); } - return new PSKeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyVaultKey(keyBundle, this.vaultUriHelper); } public CertificateBundle MergeCertificate(string vaultName, string certName, X509Certificate2Collection certs, IDictionary tags) @@ -179,7 +179,7 @@ public CertificateBundle ImportCertificate(string vaultName, string certName, X5 return certBundle; } - public PSKeyBundle ImportKey(string vaultName, string keyName, PSKeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm) + public PSKeyVaultKey ImportKey(string vaultName, string keyName, PSKeyVaultKeyAttributes keyAttributes, JsonWebKey webKey, bool? importToHsm) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -211,10 +211,10 @@ public PSKeyBundle ImportKey(string vaultName, string keyName, PSKeyAttributes k throw GetInnerException(ex); } - return new PSKeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyVaultKey(keyBundle, this.vaultUriHelper); } - public PSKeyBundle UpdateKey(string vaultName, string keyName, string keyVersion, PSKeyAttributes keyAttributes) + public PSKeyVaultKey UpdateKey(string vaultName, string keyName, string keyVersion, PSKeyVaultKeyAttributes keyAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -237,7 +237,7 @@ public PSKeyBundle UpdateKey(string vaultName, string keyName, string keyVersion throw GetInnerException(ex); } - return new PSKeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyVaultKey(keyBundle, this.vaultUriHelper); } public Contacts GetCertificateContacts(string vaultName) @@ -298,7 +298,7 @@ public CertificateBundle GetCertificate(string vaultName, string certName, strin return certBundle; } - public PSKeyBundle GetKey(string vaultName, string keyName, string keyVersion) + public PSKeyVaultKey GetKey(string vaultName, string keyName, string keyVersion) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -324,10 +324,10 @@ public PSKeyBundle GetKey(string vaultName, string keyName, string keyVersion) throw GetInnerException(ex); } - return new PSKeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyVaultKey(keyBundle, this.vaultUriHelper); } - public IEnumerable GetCertificates(KeyVaultObjectFilterOptions options) + public IEnumerable GetCertificates(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -347,8 +347,8 @@ public IEnumerable GetCertificates(KeyVaultObjectFilt result = this.keyVaultClient.GetCertificatesNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((certItem) => { return new PSCertificateIdentityItem(certItem, this.vaultUriHelper); }); + return (result == null) ? new List() : + result.Select((certItem) => { return new PSKeyVaultCertificateIdentityItem(certItem, this.vaultUriHelper); }); } catch (Exception ex) { @@ -356,7 +356,7 @@ public IEnumerable GetCertificates(KeyVaultObjectFilt } } - public IEnumerable GetCertificateVersions(KeyVaultObjectFilterOptions options) + public IEnumerable GetCertificateVersions(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -379,7 +379,7 @@ public IEnumerable GetCertificateVersions(KeyVaultObj result = this.keyVaultClient.GetCertificateVersionsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return result.Select((certificateItem) => new PSCertificateIdentityItem(certificateItem, this.vaultUriHelper)); + return result.Select((certificateItem) => new PSKeyVaultCertificateIdentityItem(certificateItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -387,7 +387,7 @@ public IEnumerable GetCertificateVersions(KeyVaultObj } } - public IEnumerable GetKeys(KeyVaultObjectFilterOptions options) + public IEnumerable GetKeys(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -407,8 +407,8 @@ public IEnumerable GetKeys(KeyVaultObjectFilterOptions option result = this.keyVaultClient.GetKeysNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((keyItem) => new PSKeyIdentityItem(keyItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select((keyItem) => new PSKeyVaultKeyIdentityItem(keyItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -416,7 +416,7 @@ public IEnumerable GetKeys(KeyVaultObjectFilterOptions option } } - public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions options) + public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -439,7 +439,7 @@ public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions result = this.keyVaultClient.GetKeyVersionsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return result.Select((keyItem) => new PSKeyIdentityItem(keyItem, this.vaultUriHelper)); + return result.Select((keyItem) => new PSKeyVaultKeyIdentityItem(keyItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -447,7 +447,7 @@ public IEnumerable GetKeyVersions(KeyVaultObjectFilterOptions } } - public PSDeletedKeyBundle DeleteKey(string vaultName, string keyName) + public PSDeletedKeyVaultKey DeleteKey(string vaultName, string keyName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -466,7 +466,7 @@ public PSDeletedKeyBundle DeleteKey(string vaultName, string keyName) throw GetInnerException(ex); } - return new PSDeletedKeyBundle(keyBundle, this.vaultUriHelper); + return new PSDeletedKeyVaultKey(keyBundle, this.vaultUriHelper); } public Contacts SetCertificateContacts(string vaultName, Contacts contacts) @@ -492,7 +492,7 @@ public Contacts SetCertificateContacts(string vaultName, Contacts contacts) return outputContacts; } - public PSSecret SetSecret(string vaultName, string secretName, SecureString secretValue, PSSecretAttributes secretAttributes) + public PSKeyVaultSecret SetSecret(string vaultName, string secretName, SecureString secretValue, PSKeyVaultSecretAttributes secretAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -518,10 +518,10 @@ public PSSecret SetSecret(string vaultName, string secretName, SecureString secr throw GetInnerException(ex); } - return new PSSecret(secret, this.vaultUriHelper); + return new PSKeyVaultSecret(secret, this.vaultUriHelper); } - public PSSecret UpdateSecret(string vaultName, string secretName, string secretVersion, PSSecretAttributes secretAttributes) + public PSKeyVaultSecret UpdateSecret(string vaultName, string secretName, string secretVersion, PSKeyVaultSecretAttributes secretAttributes) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -545,10 +545,10 @@ public PSSecret UpdateSecret(string vaultName, string secretName, string secretV throw GetInnerException(ex); } - return new PSSecret(secret, this.vaultUriHelper); + return new PSKeyVaultSecret(secret, this.vaultUriHelper); } - public PSSecret GetSecret(string vaultName, string secretName, string secretVersion) + public PSKeyVaultSecret GetSecret(string vaultName, string secretName, string secretVersion) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -573,10 +573,10 @@ public PSSecret GetSecret(string vaultName, string secretName, string secretVers throw GetInnerException(ex); } - return new PSSecret(secret, this.vaultUriHelper); + return new PSKeyVaultSecret(secret, this.vaultUriHelper); } - public IEnumerable GetSecrets(KeyVaultObjectFilterOptions options) + public IEnumerable GetSecrets(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -595,8 +595,8 @@ public IEnumerable GetSecrets(KeyVaultObjectFilterOptions result = this.keyVaultClient.GetSecretsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((secretItem) => new PSSecretIdentityItem(secretItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select((secretItem) => new PSKeyVaultSecretIdentityItem(secretItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -604,7 +604,7 @@ public IEnumerable GetSecrets(KeyVaultObjectFilterOptions } } - public IEnumerable GetSecretVersions(KeyVaultObjectFilterOptions options) + public IEnumerable GetSecretVersions(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -625,7 +625,7 @@ public IEnumerable GetSecretVersions(KeyVaultObjectFilterO result = this.keyVaultClient.GetSecretVersionsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return result.Select((secretItem) => new PSSecretIdentityItem(secretItem, this.vaultUriHelper)); + return result.Select((secretItem) => new PSKeyVaultSecretIdentityItem(secretItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -797,7 +797,7 @@ public CertificateOperation DeleteCertificateOperation(string vaultName, string return certificateOperation; } - public PSDeletedSecret DeleteSecret(string vaultName, string secretName) + public PSDeletedKeyVaultSecret DeleteSecret(string vaultName, string secretName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -816,7 +816,7 @@ public PSDeletedSecret DeleteSecret(string vaultName, string secretName) throw GetInnerException(ex); } - return new PSDeletedSecret(secret, this.vaultUriHelper); + return new PSDeletedKeyVaultSecret(secret, this.vaultUriHelper); } public string BackupKey(string vaultName, string keyName, string outputBlobPath) @@ -845,7 +845,7 @@ public string BackupKey(string vaultName, string keyName, string outputBlobPath) return outputBlobPath; } - public PSKeyBundle RestoreKey(string vaultName, string inputBlobPath) + public PSKeyVaultKey RestoreKey(string vaultName, string inputBlobPath) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -866,7 +866,7 @@ public PSKeyBundle RestoreKey(string vaultName, string inputBlobPath) throw GetInnerException(ex); } - return new PSKeyBundle(keyBundle, this.vaultUriHelper); + return new PSKeyVaultKey(keyBundle, this.vaultUriHelper); } public string BackupSecret( string vaultName, string secretName, string outputBlobPath ) @@ -895,7 +895,7 @@ public string BackupSecret( string vaultName, string secretName, string outputBl return outputBlobPath; } - public PSSecret RestoreSecret( string vaultName, string inputBlobPath ) + public PSKeyVaultSecret RestoreSecret( string vaultName, string inputBlobPath ) { if ( string.IsNullOrEmpty( vaultName ) ) throw new ArgumentNullException(nameof(vaultName)); @@ -916,7 +916,7 @@ public PSSecret RestoreSecret( string vaultName, string inputBlobPath ) throw GetInnerException( ex ); } - return new PSSecret( secretBundle, this.vaultUriHelper ); + return new PSKeyVaultSecret( secretBundle, this.vaultUriHelper ); } public CertificatePolicy GetCertificatePolicy(string vaultName, string certificateName) @@ -1001,7 +1001,7 @@ public IssuerBundle GetCertificateIssuer(string vaultName, string issuerName) return certificateIssuer; } - public IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options) + public IEnumerable GetCertificateIssuers(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); @@ -1021,8 +1021,8 @@ public IEnumerable GetCertificateIssuers(KeyVau result = this.keyVaultClient.GetCertificateIssuersNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select(issuerItem => new PSCertificateIssuerIdentityItem(issuerItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select(issuerItem => new PSKeyVaultCertificateIssuerIdentityItem(issuerItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -1391,7 +1391,7 @@ private Exception GetInnerException(Exception exception) return exception; } - public PSDeletedKeyBundle GetDeletedKey(string vaultName, string keyName) + public PSDeletedKeyVaultKey GetDeletedKey(string vaultName, string keyName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException("vaultName"); @@ -1417,10 +1417,10 @@ public PSDeletedKeyBundle GetDeletedKey(string vaultName, string keyName) throw GetInnerException(ex); } - return new PSDeletedKeyBundle(deletedKeyBundle, this.vaultUriHelper); + return new PSDeletedKeyVaultKey(deletedKeyBundle, this.vaultUriHelper); } - public IEnumerable GetDeletedKeys(KeyVaultObjectFilterOptions options) + public IEnumerable GetDeletedKeys(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException("options"); @@ -1440,8 +1440,8 @@ public IEnumerable GetDeletedKeys(KeyVaultObjectFilter result = this.keyVaultClient.GetDeletedKeysNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((deletedKeyItem) => new PSDeletedKeyIdentityItem(deletedKeyItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select((deletedKeyItem) => new PSDeletedKeyVaultKeyIdentityItem(deletedKeyItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -1449,7 +1449,7 @@ public IEnumerable GetDeletedKeys(KeyVaultObjectFilter } } - public PSDeletedSecret GetDeletedSecret(string vaultName, string secretName) + public PSDeletedKeyVaultSecret GetDeletedSecret(string vaultName, string secretName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException("vaultName"); @@ -1475,10 +1475,10 @@ public PSDeletedSecret GetDeletedSecret(string vaultName, string secretName) throw GetInnerException(ex); } - return new PSDeletedSecret(deletedSecret, this.vaultUriHelper); + return new PSDeletedKeyVaultSecret(deletedSecret, this.vaultUriHelper); } - public IEnumerable GetDeletedSecrets(KeyVaultObjectFilterOptions options) + public IEnumerable GetDeletedSecrets(KeyVaultObjectFilterOptions options) { if (options == null) throw new ArgumentNullException("options"); @@ -1497,8 +1497,8 @@ public IEnumerable GetDeletedSecrets(KeyVaultObject result = this.keyVaultClient.GetDeletedSecretsNextAsync(options.NextLink).GetAwaiter().GetResult(); options.NextLink = result.NextPageLink; - return (result == null) ? new List() : - result.Select((deletedSecretItem) => new PSDeletedSecretIdentityItem(deletedSecretItem, this.vaultUriHelper)); + return (result == null) ? new List() : + result.Select((deletedSecretItem) => new PSDeletedKeyVaultSecretIdentityItem(deletedSecretItem, this.vaultUriHelper)); } catch (Exception ex) { @@ -1544,7 +1544,7 @@ public void PurgeSecret(string vaultName, string secretName) } } - public PSKeyBundle RecoverKey(string vaultName, string keyName) + public PSKeyVaultKey RecoverKey(string vaultName, string keyName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException("vaultName"); @@ -1563,10 +1563,10 @@ public PSKeyBundle RecoverKey(string vaultName, string keyName) throw GetInnerException(ex); } - return new PSKeyBundle(recoveredKey, this.vaultUriHelper); + return new PSKeyVaultKey(recoveredKey, this.vaultUriHelper); } - public PSSecret RecoverSecret(string vaultName, string secretName) + public PSKeyVaultSecret RecoverSecret(string vaultName, string secretName) { if (string.IsNullOrEmpty(vaultName)) throw new ArgumentNullException("vaultName"); @@ -1585,7 +1585,7 @@ public PSSecret RecoverSecret(string vaultName, string secretName) throw GetInnerException(ex); } - return new PSSecret(recoveredSecret, this.vaultUriHelper); + return new PSKeyVaultSecret(recoveredSecret, this.vaultUriHelper); } public DeletedCertificateBundle GetDeletedCertificate( string vaultName, string certName ) @@ -1617,7 +1617,7 @@ public DeletedCertificateBundle GetDeletedCertificate( string vaultName, string return deletedCertificate; } - public IEnumerable GetDeletedCertificates( KeyVaultObjectFilterOptions options ) + public IEnumerable GetDeletedCertificates( KeyVaultObjectFilterOptions options ) { if ( options == null ) throw new ArgumentNullException( nameof( options ) ); @@ -1636,8 +1636,8 @@ public IEnumerable GetDeletedCertificates( Key result = this.keyVaultClient.GetDeletedCertificatesNextAsync( options.NextLink ).GetAwaiter( ).GetResult( ); options.NextLink = result.NextPageLink; - return ( result == null ) ? new List( ) : - result.Select( ( deletedItem ) => new PSDeletedCertificateIdentityItem( deletedItem, this.vaultUriHelper ) ); + return ( result == null ) ? new List( ) : + result.Select( ( deletedItem ) => new PSDeletedKeyVaultCertificateIdentityItem( deletedItem, this.vaultUriHelper ) ); } catch ( Exception ex ) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultManagementCmdletBase.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultManagementCmdletBase.cs index 1c3d3d65d4fd..a62104519276 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultManagementCmdletBase.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/KeyVaultManagementCmdletBase.cs @@ -101,7 +101,7 @@ public ResourceManagementClient ResourceClient set { this._resourceClient = value; } } - protected List ListVaults(string resourceGroupName, Hashtable tag) + protected List ListVaults(string resourceGroupName, Hashtable tag) { IResourceManagementClient armClient = this.ResourceClient; @@ -133,11 +133,11 @@ public ResourceManagementClient ResourceClient r.Tagvalue == tagValuePair.Value)); } - List vaults = new List(); + List vaults = new List(); if (listResult != null) { vaults.AddRange(listResult.Where(r => r.Type.Equals(KeyVaultManagementClient.VaultsResourceType, StringComparison.OrdinalIgnoreCase)) - .Select(r => new PSKeyVaultModels.PSVaultIdentityItem(r))); + .Select(r => new PSKeyVaultModels.PSKeyVaultIdentityItem(r))); } while (!string.IsNullOrEmpty(listResult.NextPageLink)) @@ -153,7 +153,7 @@ public ResourceManagementClient ResourceClient if (listResult != null) { - vaults.AddRange(listResult.Select(r => new PSKeyVaultModels.PSVaultIdentityItem(r))); + vaults.AddRange(listResult.Select(r => new PSKeyVaultModels.PSKeyVaultIdentityItem(r))); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/ModelExtensions.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/ModelExtensions.cs index 891e5af33d5b..84afead338b8 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/ModelExtensions.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/ModelExtensions.cs @@ -29,7 +29,7 @@ namespace Microsoft.Azure.Commands.KeyVault static class ModelExtensions { - public static string ConstructAccessPoliciesTableAsTable(IEnumerable policies) + public static string ConstructAccessPoliciesTableAsTable(IEnumerable policies) { StringBuilder sb = new StringBuilder(); @@ -59,7 +59,7 @@ public static string ConstructAccessPoliciesTableAsTable(IEnumerable policies) + public static string ConstructAccessPoliciesList(IEnumerable policies) { StringBuilder sb = new StringBuilder(); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyIdentityItem.cs deleted file mode 100644 index 64cdad7056a9..000000000000 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyIdentityItem.cs +++ /dev/null @@ -1,38 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; - -namespace Microsoft.Azure.Commands.KeyVault.Models -{ - public class PSDeletedKeyIdentityItem : PSKeyIdentityItem - { - internal PSDeletedKeyIdentityItem(Azure.KeyVault.Models.DeletedKeyItem keyItem, VaultUriHelper vaultUriHelper) : base(keyItem, vaultUriHelper) - { - ScheduledPurgeDate = keyItem.ScheduledPurgeDate; - DeletedDate = keyItem.DeletedDate; - } - - internal PSDeletedKeyIdentityItem(PSDeletedKeyBundle keyBundle) : base(keyBundle) - { - ScheduledPurgeDate = keyBundle.ScheduledPurgeDate; - DeletedDate = keyBundle.DeletedDate; - } - - public DateTime? ScheduledPurgeDate { get; set; } - - public DateTime? DeletedDate { get; set; } - - } -} diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVault.cs similarity index 93% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedVault.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVault.cs index 9c529e916a2d..06c05786b4e9 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVault.cs @@ -17,9 +17,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSDeletedVault : PSVault + public class PSDeletedKeyVault : PSKeyVault { - internal PSDeletedVault(DeletedVault vault) + internal PSDeletedKeyVault(DeletedVault vault) { Id = vault.Id; VaultName = vault.Name; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificate.cs index 5cd83dbe3cfc..9b3a64c806b2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificate.cs @@ -12,18 +12,118 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.KeyVault.Models; using System; +using System.Collections; +using System.Linq; +using System.Security.Cryptography.X509Certificates; namespace Microsoft.Azure.Commands.KeyVault.Models { - public sealed class PSDeletedKeyVaultCertificate : PSKeyVaultCertificate + public sealed class PSDeletedKeyVaultCertificate : PSDeletedKeyVaultCertificateIdentityItem { - public PSDeletedKeyVaultCertificate( Azure.KeyVault.Models.DeletedCertificateBundle deletedCertificateBundle ) - :base( deletedCertificateBundle ) + internal PSDeletedKeyVaultCertificate(DeletedCertificateBundle deletedCertificateBundle, VaultUriHelper vaultUriHelper) { - if ( deletedCertificateBundle == null ) + if (deletedCertificateBundle == null) + { + throw new ArgumentNullException(nameof(deletedCertificateBundle)); + } + + if (deletedCertificateBundle.CertificateIdentifier == null) + throw new ArgumentException(Resources.InvalidKeyIdentifier); + + SetObjectIdentifier(vaultUriHelper, deletedCertificateBundle.CertificateIdentifier); + + // VaultName formatted incorrect in certificateBundle + var vaultUri = new Uri(deletedCertificateBundle.CertificateIdentifier.Vault); + VaultName = vaultUri.Host.Split('.').First(); + + if (deletedCertificateBundle.Cer != null) + { + Certificate = new X509Certificate2(deletedCertificateBundle.Cer); + Thumbprint = Certificate.Thumbprint; + } + + if (deletedCertificateBundle.KeyIdentifier != null) + { + KeyId = deletedCertificateBundle.KeyIdentifier.Identifier; + } + + if (deletedCertificateBundle.SecretIdentifier != null) + { + SecretId = deletedCertificateBundle.SecretIdentifier.Identifier; + } + + if (deletedCertificateBundle.Attributes != null) + { + Created = deletedCertificateBundle.Attributes.Created; + Expires = deletedCertificateBundle.Attributes.Expires; + NotBefore = deletedCertificateBundle.Attributes.NotBefore; + Enabled = deletedCertificateBundle.Attributes.Enabled; + Updated = deletedCertificateBundle.Attributes.Updated; + RecoveryLevel = deletedCertificateBundle.Attributes.RecoveryLevel; + } + + if (deletedCertificateBundle.Tags != null) + { + Tags = (Hashtable) deletedCertificateBundle.Tags; + } + + ScheduledPurgeDate = deletedCertificateBundle.ScheduledPurgeDate; + DeletedDate = deletedCertificateBundle.DeletedDate; + } + + internal PSDeletedKeyVaultCertificate(DeletedCertificateBundle deletedCertificateBundle) + { + if (deletedCertificateBundle == null) + { + throw new ArgumentNullException(nameof(deletedCertificateBundle)); + } + + if (deletedCertificateBundle.CertificateIdentifier == null) + throw new ArgumentException(Resources.InvalidKeyIdentifier); + + var vaultUri = new Uri(deletedCertificateBundle.CertificateIdentifier.Vault); + + SetObjectIdentifier(new ObjectIdentifier + { + Id = deletedCertificateBundle.CertificateIdentifier.Identifier, + Name = deletedCertificateBundle.CertificateIdentifier.Name, + // VaultName formatted incorrect in certificateBundle + VaultName = vaultUri.Host.Split('.').First(), + Version = deletedCertificateBundle.CertificateIdentifier.Version + }); + + if (deletedCertificateBundle.Cer != null) + { + Certificate = new X509Certificate2(deletedCertificateBundle.Cer); + Thumbprint = Certificate.Thumbprint; + } + + if (deletedCertificateBundle.KeyIdentifier != null) + { + KeyId = deletedCertificateBundle.KeyIdentifier.Identifier; + } + + if (deletedCertificateBundle.SecretIdentifier != null) + { + SecretId = deletedCertificateBundle.SecretIdentifier.Identifier; + } + + if (deletedCertificateBundle.Attributes != null) + { + Created = deletedCertificateBundle.Attributes.Created; + Expires = deletedCertificateBundle.Attributes.Expires; + NotBefore = deletedCertificateBundle.Attributes.NotBefore; + Enabled = deletedCertificateBundle.Attributes.Enabled; + Updated = deletedCertificateBundle.Attributes.Updated; + RecoveryLevel = deletedCertificateBundle.Attributes.RecoveryLevel; + } + + if (deletedCertificateBundle.Tags != null) { - throw new ArgumentNullException( nameof( deletedCertificateBundle ) ); + Tags = (Hashtable) deletedCertificateBundle.Tags; } ScheduledPurgeDate = deletedCertificateBundle.ScheduledPurgeDate; @@ -40,8 +140,11 @@ internal static PSDeletedKeyVaultCertificate FromDeletedCertificateBundle( Azure return new PSDeletedKeyVaultCertificate( deletedCertificateBundle ); } - public DateTime? ScheduledPurgeDate { get; set; } + public X509Certificate2 Certificate { get; set; } + public string KeyId { get; internal set; } + public string SecretId { get; internal set; } + public string Thumbprint { get; set; } - public DateTime? DeletedDate { get; set; } + public string RecoveryLevel { get; private set; } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedCertificateIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificateIdentityItem.cs similarity index 77% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedCertificateIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificateIdentityItem.cs index 8904eb2a7ff1..72780d592191 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedCertificateIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultCertificateIdentityItem.cs @@ -17,16 +17,19 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSDeletedCertificateIdentityItem : PSCertificateIdentityItem + public class PSDeletedKeyVaultCertificateIdentityItem : PSKeyVaultCertificateIdentityItem { - internal PSDeletedCertificateIdentityItem( DeletedCertificateItem certItem, VaultUriHelper vaultUriHelper ) + public PSDeletedKeyVaultCertificateIdentityItem() + { } + + internal PSDeletedKeyVaultCertificateIdentityItem( DeletedCertificateItem certItem, VaultUriHelper vaultUriHelper ) :base(certItem, vaultUriHelper) { ScheduledPurgeDate = certItem.ScheduledPurgeDate; DeletedDate = certItem.DeletedDate; } - internal PSDeletedCertificateIdentityItem( DeletedCertificateBundle certBundle ) + internal PSDeletedKeyVaultCertificateIdentityItem( DeletedCertificateBundle certBundle ) :base( certBundle ) { ScheduledPurgeDate = certBundle.ScheduledPurgeDate; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultKey.cs new file mode 100644 index 000000000000..3d65078fd62a --- /dev/null +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultKey.cs @@ -0,0 +1,66 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.KeyVault.Properties; +using Microsoft.Azure.KeyVault.WebKey; +using System; +using System.Linq; + +namespace Microsoft.Azure.Commands.KeyVault.Models +{ + public class PSDeletedKeyVaultKey : PSDeletedKeyVaultKeyIdentityItem + { + public PSDeletedKeyVaultKey() + { } + + internal PSDeletedKeyVaultKey(Azure.KeyVault.Models.DeletedKeyBundle deletedKeyBundle, VaultUriHelper vaultUriHelper) + { + if (deletedKeyBundle == null) + throw new ArgumentNullException("keyItem"); + if (deletedKeyBundle.Attributes == null) + throw new ArgumentException(Resources.InvalidKeyAttributes); + if (deletedKeyBundle.KeyIdentifier == null) + throw new ArgumentException(Resources.InvalidKeyIdentifier); + + SetObjectIdentifier(vaultUriHelper, deletedKeyBundle.KeyIdentifier); + + Key = deletedKeyBundle.Key; + Attributes = new PSKeyVaultKeyAttributes( + deletedKeyBundle.Attributes.Enabled, + deletedKeyBundle.Attributes.Expires, + deletedKeyBundle.Attributes.NotBefore, + deletedKeyBundle.Key.Kty, + deletedKeyBundle.Key.KeyOps.ToArray(), + deletedKeyBundle.Attributes.Created, + deletedKeyBundle.Attributes.Updated, + deletedKeyBundle.Attributes.RecoveryLevel, + deletedKeyBundle.Tags); + + Enabled = deletedKeyBundle.Attributes.Enabled; + Expires = deletedKeyBundle.Attributes.Expires; + NotBefore = deletedKeyBundle.Attributes.NotBefore; + Created = deletedKeyBundle.Attributes.Created; + Updated = deletedKeyBundle.Attributes.Updated; + RecoveryLevel = deletedKeyBundle.Attributes.RecoveryLevel; + Tags = (deletedKeyBundle.Tags == null) ? null : deletedKeyBundle.Tags.ConvertToHashtable(); + + ScheduledPurgeDate = deletedKeyBundle.ScheduledPurgeDate; + DeletedDate = deletedKeyBundle.DeletedDate; + } + + public PSKeyVaultKeyAttributes Attributes { get; set; } + + public JsonWebKey Key { get; set; } + } +} diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyBundle.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultKeyIdentityItem.cs similarity index 71% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyBundle.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultKeyIdentityItem.cs index 86dbe02bf35c..dd7f54fc49da 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyBundle.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultKeyIdentityItem.cs @@ -16,19 +16,20 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSDeletedKeyBundle : PSKeyBundle + public class PSDeletedKeyVaultKeyIdentityItem : PSKeyVaultKeyIdentityItem { - public PSDeletedKeyBundle() + public PSDeletedKeyVaultKeyIdentityItem() { } - internal PSDeletedKeyBundle(Azure.KeyVault.Models.DeletedKeyBundle deletedKeyBundle, VaultUriHelper vaultUriHelper) : base(deletedKeyBundle, vaultUriHelper) + internal PSDeletedKeyVaultKeyIdentityItem(Azure.KeyVault.Models.DeletedKeyItem keyItem, VaultUriHelper vaultUriHelper) : base(keyItem, vaultUriHelper) { - ScheduledPurgeDate = deletedKeyBundle.ScheduledPurgeDate; - DeletedDate = deletedKeyBundle.DeletedDate; + ScheduledPurgeDate = keyItem.ScheduledPurgeDate; + DeletedDate = keyItem.DeletedDate; } public DateTime? ScheduledPurgeDate { get; set; } public DateTime? DeletedDate { get; set; } + } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultSecret.cs new file mode 100644 index 000000000000..06565998a97b --- /dev/null +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultSecret.cs @@ -0,0 +1,80 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.KeyVault.Properties; +using System; +using System.Security; + +namespace Microsoft.Azure.Commands.KeyVault.Models +{ + public class PSDeletedKeyVaultSecret : PSDeletedKeyVaultSecretIdentityItem + { + public PSDeletedKeyVaultSecret() + { } + + /// + /// Internal constructor used by KeyVaultDataServiceClient + /// + /// secret returned from service + /// helper class + internal PSDeletedKeyVaultSecret(Azure.KeyVault.Models.DeletedSecretBundle deletedSecret, VaultUriHelper vaultUriHelper) + { + if (deletedSecret == null) + throw new ArgumentNullException("secret"); + if (deletedSecret.Attributes == null) + throw new ArgumentException(Resources.InvalidSecretAttributes); + if (deletedSecret.SecretIdentifier == null) + throw new ArgumentException(Resources.InvalidSecretIdentifier); + + SetObjectIdentifier(vaultUriHelper, deletedSecret.SecretIdentifier); + if (deletedSecret.Value != null) + SecretValue = deletedSecret.Value.ConvertToSecureString(); + + Enabled = deletedSecret.Attributes.Enabled; + Expires = deletedSecret.Attributes.Expires; + NotBefore = deletedSecret.Attributes.NotBefore; + Created = deletedSecret.Attributes.Created; + Updated = deletedSecret.Attributes.Updated; + ContentType = deletedSecret.ContentType; + Tags = (deletedSecret.Tags == null) ? null : deletedSecret.Tags.ConvertToHashtable(); + + Attributes = new PSKeyVaultSecretAttributes( + deletedSecret.Attributes.Enabled, + deletedSecret.Attributes.Expires, + deletedSecret.Attributes.NotBefore, + deletedSecret.Attributes.Created, + deletedSecret.Attributes.Updated, + deletedSecret.ContentType, + deletedSecret.Attributes.RecoveryLevel, + deletedSecret.Tags); + + ScheduledPurgeDate = deletedSecret.ScheduledPurgeDate; + DeletedDate = deletedSecret.DeletedDate; + } + + public SecureString SecretValue { get; set; } + + public string SecretValueText + { + get + { + string text = null; + if (SecretValue != null) + text = SecretValue.ConvertToString(); + return text; + } + } + public PSKeyVaultSecretAttributes Attributes { get; set; } + } +} \ No newline at end of file diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecretIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultSecretIdentityItem.cs similarity index 71% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecretIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultSecretIdentityItem.cs index e04ec90c4bd1..d958cfa50cb6 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecretIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedKeyVaultSecretIdentityItem.cs @@ -16,20 +16,17 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSDeletedSecretIdentityItem : PSSecretIdentityItem + public class PSDeletedKeyVaultSecretIdentityItem : PSKeyVaultSecretIdentityItem { - internal PSDeletedSecretIdentityItem(Azure.KeyVault.Models.DeletedSecretItem secretItem, VaultUriHelper vaultUriHelper) : base(secretItem, vaultUriHelper) + public PSDeletedKeyVaultSecretIdentityItem() + { } + + internal PSDeletedKeyVaultSecretIdentityItem(Azure.KeyVault.Models.DeletedSecretItem secretItem, VaultUriHelper vaultUriHelper) : base(secretItem, vaultUriHelper) { ScheduledPurgeDate = secretItem.ScheduledPurgeDate; DeletedDate = secretItem.DeletedDate; } - internal PSDeletedSecretIdentityItem(PSDeletedSecret secret) : base(secret) - { - ScheduledPurgeDate = secret.ScheduledPurgeDate; - DeletedDate = secret.DeletedDate; - } - public DateTime? ScheduledPurgeDate { get; set; } public DateTime? DeletedDate { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecret.cs deleted file mode 100644 index eab45415cb2e..000000000000 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSDeletedSecret.cs +++ /dev/null @@ -1,41 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - -using System; -using System.Security; - -namespace Microsoft.Azure.Commands.KeyVault.Models -{ - public class PSDeletedSecret : PSSecret - { - public PSDeletedSecret() - { } - - /// - /// Internal constructor used by KeyVaultDataServiceClient - /// - /// secret returned from service - /// helper class - internal PSDeletedSecret(Azure.KeyVault.Models.DeletedSecretBundle deletedSecret, VaultUriHelper vaultUriHelper) : base(deletedSecret, vaultUriHelper) - { - ScheduledPurgeDate = deletedSecret.ScheduledPurgeDate; - DeletedDate = deletedSecret.DeletedDate; - } - - public DateTime? ScheduledPurgeDate { get; set; } - - public DateTime? DeletedDate { get; set; } - - } -} diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVault.cs similarity index 91% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSVault.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVault.cs index 1bc043aae258..13e144e7e97d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVault.cs @@ -26,13 +26,13 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSVault : PSVaultIdentityItem + public class PSKeyVault : PSKeyVaultIdentityItem { - public PSVault() + public PSKeyVault() { } - public PSVault(Vault vault, ActiveDirectoryClient adClient) + public PSKeyVault(Vault vault, ActiveDirectoryClient adClient) { var vaultTenantDisplayName = ModelExtensions.GetDisplayNameForTenant(vault.Properties.TenantId, adClient); VaultName = vault.Name; @@ -48,7 +48,7 @@ public PSVault(Vault vault, ActiveDirectoryClient adClient) EnabledForTemplateDeployment = vault.Properties.EnabledForTemplateDeployment; EnabledForDiskEncryption = vault.Properties.EnabledForDiskEncryption; EnableSoftDelete = vault.Properties.EnableSoftDelete; - AccessPolicies = vault.Properties.AccessPolicies.Select(s => new PSVaultAccessPolicy(s, adClient)).ToArray(); + AccessPolicies = vault.Properties.AccessPolicies.Select(s => new PSKeyVaultAccessPolicy(s, adClient)).ToArray(); OriginalVault = vault; } public string VaultUri { get; private set; } @@ -67,7 +67,7 @@ public PSVault(Vault vault, ActiveDirectoryClient adClient) public bool? EnableSoftDelete { get; private set; } - public PSVaultAccessPolicy[] AccessPolicies { get; private set; } + public PSKeyVaultAccessPolicy[] AccessPolicies { get; private set; } public string AccessPoliciesText { get { return ModelExtensions.ConstructAccessPoliciesList(AccessPolicies); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSVaultAccessPolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultAccessPolicy.cs similarity index 90% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSVaultAccessPolicy.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultAccessPolicy.cs index 2194ac179c24..d0c737e1fdcf 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSVaultAccessPolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultAccessPolicy.cs @@ -23,9 +23,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSVaultAccessPolicy + public class PSKeyVaultAccessPolicy { - public PSVaultAccessPolicy( Guid tenantId, string objectId, Guid? applicationId, string[] permissionsToKeys, string[] permissionsToSecrets, string[] permissionsToCertificates, string[] permissionsToStorage ) + public PSKeyVaultAccessPolicy( Guid tenantId, string objectId, Guid? applicationId, string[] permissionsToKeys, string[] permissionsToSecrets, string[] permissionsToCertificates, string[] permissionsToStorage ) { TenantId = tenantId; ObjectId = objectId; @@ -36,7 +36,7 @@ public PSVaultAccessPolicy( Guid tenantId, string objectId, Guid? applicationId, PermissionsToStorage = permissionsToStorage == null ? new List() : new List( permissionsToStorage ); } - public PSVaultAccessPolicy(KeyVaultManagement.Models.AccessPolicyEntry s, ActiveDirectoryClient adClient) + public PSKeyVaultAccessPolicy(KeyVaultManagement.Models.AccessPolicyEntry s, ActiveDirectoryClient adClient) { ObjectId = s.ObjectId; DisplayName = ModelExtensions.GetDisplayNameForADObject(s.ObjectId, adClient); diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificate.cs index e8a59269848e..e56e41eb2bad 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificate.cs @@ -11,49 +11,40 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.Azure.Commands.KeyVault.Properties; using Microsoft.Azure.KeyVault.Models; using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSKeyVaultCertificate + public class PSKeyVaultCertificate : PSKeyVaultCertificateIdentityItem { - public string Name { get; set; } - public string VaultName { get; set; } public X509Certificate2 Certificate { get; set; } - public string Id { get; internal set; } public string KeyId { get; internal set; } public string SecretId { get; internal set; } public string Thumbprint { get; set; } - public IDictionary Tags { get; set; } - - public bool? Enabled { get; set; } - public DateTime? Created { get; internal set; } - public DateTime? Updated { get; internal set; } public string RecoveryLevel { get; private set; } - public PSKeyVaultCertificate( CertificateBundle certificateBundle ) + internal PSKeyVaultCertificate(CertificateBundle certificateBundle, VaultUriHelper vaultUriHelper) { if ( certificateBundle == null ) { throw new ArgumentNullException( nameof( certificateBundle ) ); } - if ( certificateBundle.Id != null ) - { - Id = certificateBundle.CertificateIdentifier.Identifier; - Name = certificateBundle.CertificateIdentifier.Name; - - // TODO [dragosav] Bring Certificate classes on par with keys/secrets: - // - inherit from ObjectIdentifier - // - constructors should accept the VaultUriHelper as a parameter - var vaultUri = new Uri( certificateBundle.CertificateIdentifier.Vault ); - VaultName = vaultUri.Host.Split( '.' ).First( ); - } + if (certificateBundle.CertificateIdentifier == null) + throw new ArgumentException(Resources.InvalidKeyIdentifier); + + SetObjectIdentifier(vaultUriHelper, certificateBundle.CertificateIdentifier); + + // VaultName formatted incorrect in certificateBundle + var vaultUri = new Uri(certificateBundle.CertificateIdentifier.Vault); + VaultName = vaultUri.Host.Split('.').First(); if ( certificateBundle.Cer != null ) { @@ -74,6 +65,8 @@ public PSKeyVaultCertificate( CertificateBundle certificateBundle ) if ( certificateBundle.Attributes != null ) { Created = certificateBundle.Attributes.Created; + Expires = certificateBundle.Attributes.Expires; + NotBefore = certificateBundle.Attributes.NotBefore; Enabled = certificateBundle.Attributes.Enabled; Updated = certificateBundle.Attributes.Updated; RecoveryLevel = certificateBundle.Attributes.RecoveryLevel; @@ -81,7 +74,60 @@ public PSKeyVaultCertificate( CertificateBundle certificateBundle ) if ( certificateBundle.Tags != null ) { - Tags = certificateBundle.Tags; + Tags = (Hashtable) certificateBundle.Tags; + } + } + + internal PSKeyVaultCertificate(CertificateBundle certificateBundle) + { + if (certificateBundle == null) + { + throw new ArgumentNullException(nameof(certificateBundle)); + } + + if (certificateBundle.CertificateIdentifier == null) + throw new ArgumentException(Resources.InvalidKeyIdentifier); + + var vaultUri = new Uri(certificateBundle.CertificateIdentifier.Vault); + + SetObjectIdentifier(new ObjectIdentifier + { + Id = certificateBundle.CertificateIdentifier.Identifier, + Name = certificateBundle.CertificateIdentifier.Name, + // VaultName formatted incorrect in certificateBundle + VaultName = vaultUri.Host.Split('.').First(), + Version = certificateBundle.CertificateIdentifier.Version + }); + + if (certificateBundle.Cer != null) + { + Certificate = new X509Certificate2(certificateBundle.Cer); + Thumbprint = Certificate.Thumbprint; + } + + if (certificateBundle.KeyIdentifier != null) + { + KeyId = certificateBundle.KeyIdentifier.Identifier; + } + + if (certificateBundle.SecretIdentifier != null) + { + SecretId = certificateBundle.SecretIdentifier.Identifier; + } + + if (certificateBundle.Attributes != null) + { + Created = certificateBundle.Attributes.Created; + Expires = certificateBundle.Attributes.Expires; + NotBefore = certificateBundle.Attributes.NotBefore; + Enabled = certificateBundle.Attributes.Enabled; + Updated = certificateBundle.Attributes.Updated; + RecoveryLevel = certificateBundle.Attributes.RecoveryLevel; + } + + if (certificateBundle.Tags != null) + { + Tags = (Hashtable)certificateBundle.Tags; } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIdentityItem.cs similarity index 87% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIdentityItem.cs index 478ba4321f42..957e8e73be33 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIdentityItem.cs @@ -19,9 +19,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSCertificateIdentityItem : ObjectIdentifier + public class PSKeyVaultCertificateIdentityItem : ObjectIdentifier { - internal PSCertificateIdentityItem(CertificateItem certItem, VaultUriHelper vaultUriHelper) + public PSKeyVaultCertificateIdentityItem() + { } + + internal PSKeyVaultCertificateIdentityItem(CertificateItem certItem, VaultUriHelper vaultUriHelper) { if (certItem == null) throw new ArgumentNullException("certItem"); @@ -40,7 +43,7 @@ internal PSCertificateIdentityItem(CertificateItem certItem, VaultUriHelper vaul Tags = (certItem.Tags == null) ? null : certItem.Tags.ConvertToHashtable(); } - internal PSCertificateIdentityItem(CertificateBundle certBundle) + internal PSKeyVaultCertificateIdentityItem(CertificateBundle certBundle) { if (certBundle == null) throw new ArgumentNullException("certBundle"); @@ -69,9 +72,9 @@ internal PSCertificateIdentityItem(CertificateBundle certBundle) public DateTime? NotBefore { get; set; } - public DateTime? Created { get; private set; } + public DateTime? Created { get; protected set; } - public DateTime? Updated { get; private set; } + public DateTime? Updated { get; protected set; } public Hashtable Tags { get; set; } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs index 3d2e67686995..4cf6f326ff2a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuer.cs @@ -17,16 +17,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSKeyVaultCertificateIssuer + public class PSKeyVaultCertificateIssuer : PSKeyVaultCertificateIssuerIdentityItem { - public string Name { get; set; } - public string IssuerProvider { get; set; } public string AccountId { get; set; } public SecureString ApiKey { get; set; } public PSKeyVaultCertificateOrganizationDetails OrganizationDetails { get; set; } - public string VaultName { get; set; } - internal static PSKeyVaultCertificateIssuer FromIssuer(IssuerBundle issuer) { if (issuer == null) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuerIdentityItem.cs similarity index 79% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuerIdentityItem.cs index 4713ca933967..aa93d64b596a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSCertificateIssuerIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultCertificateIssuerIdentityItem.cs @@ -18,9 +18,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSCertificateIssuerIdentityItem + public class PSKeyVaultCertificateIssuerIdentityItem { - internal PSCertificateIssuerIdentityItem(CertificateIssuerItem issuerItem, VaultUriHelper vaultUriHelper) + public PSKeyVaultCertificateIssuerIdentityItem() + { } + + internal PSKeyVaultCertificateIssuerIdentityItem(CertificateIssuerItem issuerItem, VaultUriHelper vaultUriHelper) { if (issuerItem == null) throw new ArgumentNullException("issuerItem"); @@ -29,7 +32,7 @@ internal PSCertificateIssuerIdentityItem(CertificateIssuerItem issuerItem, Vault IssuerProvider = issuerItem.Provider; } - internal PSCertificateIssuerIdentityItem(IssuerBundle issuer) + internal PSKeyVaultCertificateIssuerIdentityItem(IssuerBundle issuer) { if (issuer == null) throw new ArgumentNullException("issuer"); @@ -40,7 +43,7 @@ internal PSCertificateIssuerIdentityItem(IssuerBundle issuer) public string Name { get; set; } - public string IssuerProvider { get; private set; } + public string IssuerProvider { get; set; } public string VaultName { get; set; } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSVaultIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultIdentityItem.cs similarity index 92% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSVaultIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultIdentityItem.cs index 25e53969f1ad..4b355fb205a8 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSVaultIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultIdentityItem.cs @@ -20,13 +20,13 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSVaultIdentityItem + public class PSKeyVaultIdentityItem { - public PSVaultIdentityItem() + public PSKeyVaultIdentityItem() { } - public PSVaultIdentityItem(ResourceManagement.GenericResource resource) + public PSKeyVaultIdentityItem(ResourceManagement.GenericResource resource) { ResourceIdentifier identifier = new ResourceIdentifier(resource.Id); VaultName = identifier.ResourceName; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyBundle.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultKey.cs similarity index 71% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyBundle.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultKey.cs index 76fd5aff63eb..9ea49a57bfd0 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyBundle.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultKey.cs @@ -19,12 +19,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSKeyBundle : ObjectIdentifier + public class PSKeyVaultKey : PSKeyVaultKeyIdentityItem { - public PSKeyBundle() + public PSKeyVaultKey() { } - internal PSKeyBundle(Azure.KeyVault.Models.KeyBundle keyBundle, VaultUriHelper vaultUriHelper) + internal PSKeyVaultKey(Azure.KeyVault.Models.KeyBundle keyBundle, VaultUriHelper vaultUriHelper) { if (keyBundle == null) throw new ArgumentNullException("keyBundle"); @@ -34,7 +34,7 @@ internal PSKeyBundle(Azure.KeyVault.Models.KeyBundle keyBundle, VaultUriHelper v SetObjectIdentifier(vaultUriHelper, keyBundle.KeyIdentifier); Key = keyBundle.Key; - Attributes = new PSKeyAttributes( + Attributes = new PSKeyVaultKeyAttributes( keyBundle.Attributes.Enabled, keyBundle.Attributes.Expires, keyBundle.Attributes.NotBefore, @@ -44,9 +44,17 @@ internal PSKeyBundle(Azure.KeyVault.Models.KeyBundle keyBundle, VaultUriHelper v keyBundle.Attributes.Updated, keyBundle.Attributes.RecoveryLevel, keyBundle.Tags); + + Enabled = keyBundle.Attributes.Enabled; + Expires = keyBundle.Attributes.Expires; + NotBefore = keyBundle.Attributes.NotBefore; + Created = keyBundle.Attributes.Created; + Updated = keyBundle.Attributes.Updated; + RecoveryLevel = keyBundle.Attributes.RecoveryLevel; + Tags = (keyBundle.Tags == null) ? null : keyBundle.Tags.ConvertToHashtable(); } - public PSKeyAttributes Attributes { get; set; } + public PSKeyVaultKeyAttributes Attributes { get; set; } public JsonWebKey Key { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyAttributes.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultKeyAttributes.cs similarity index 90% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyAttributes.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultKeyAttributes.cs index 3c925c344b77..e1331316d596 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyAttributes.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultKeyAttributes.cs @@ -21,12 +21,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models /// /// Key attributes from PSH perspective /// - public class PSKeyAttributes + public class PSKeyVaultKeyAttributes { - public PSKeyAttributes() + public PSKeyVaultKeyAttributes() { } - internal PSKeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string keyType, + internal PSKeyVaultKeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string keyType, string[] keyOps, Hashtable tags) { this.Enabled = enabled; @@ -37,7 +37,7 @@ internal PSKeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, this.Tags = tags; } - internal PSKeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string keyType, + internal PSKeyVaultKeyAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string keyType, string[] keyOps, DateTime? created, DateTime? updated, string deletionRecoveryLevel, IDictionary tags) { this.Enabled = enabled; @@ -87,7 +87,7 @@ public Dictionary TagsDirectionary } } - public static explicit operator Azure.KeyVault.Models.KeyAttributes(PSKeyAttributes attr) + public static explicit operator Azure.KeyVault.Models.KeyAttributes(PSKeyVaultKeyAttributes attr) { return new Azure.KeyVault.Models.KeyAttributes() { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultKeyIdentityItem.cs similarity index 84% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultKeyIdentityItem.cs index d6e99c05f3f9..f60e2a8006ab 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultKeyIdentityItem.cs @@ -18,9 +18,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSKeyIdentityItem : ObjectIdentifier + public class PSKeyVaultKeyIdentityItem : ObjectIdentifier { - internal PSKeyIdentityItem(Azure.KeyVault.Models.KeyItem keyItem, VaultUriHelper vaultUriHelper) + public PSKeyVaultKeyIdentityItem() + { } + + internal PSKeyVaultKeyIdentityItem(Azure.KeyVault.Models.KeyItem keyItem, VaultUriHelper vaultUriHelper) { if (keyItem == null) throw new ArgumentNullException("keyItem"); @@ -40,7 +43,7 @@ internal PSKeyIdentityItem(Azure.KeyVault.Models.KeyItem keyItem, VaultUriHelper Tags = (keyItem.Tags == null) ? null : keyItem.Tags.ConvertToHashtable(); } - internal PSKeyIdentityItem(PSKeyBundle keyBundle) + internal PSKeyVaultKeyIdentityItem(PSKeyVaultKey keyBundle) { if (keyBundle == null) throw new ArgumentNullException("keyBundle"); @@ -64,14 +67,14 @@ internal PSKeyIdentityItem(PSKeyBundle keyBundle) public DateTime? NotBefore { get; set; } - public DateTime? Created { get; private set; } + public DateTime? Created { get; protected set; } - public DateTime? Updated { get; private set; } + public DateTime? Updated { get; protected set; } [Obsolete( "The PurgeDisabled property is being deprecated and will be removed in a future release. Please use the RecoveryLevel property instead." )] - public bool PurgeDisabled { get; private set; } + public bool PurgeDisabled { get; protected set; } - public string RecoveryLevel { get; private set; } + public string RecoveryLevel { get; protected set; } public Hashtable Tags { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultSecret.cs similarity index 74% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultSecret.cs index 3054bc1d97b3..774c756f9507 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultSecret.cs @@ -17,9 +17,9 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSSecret : ObjectIdentifier + public class PSKeyVaultSecret : PSKeyVaultSecretIdentityItem { - public PSSecret() + public PSKeyVaultSecret() { } /// @@ -27,7 +27,7 @@ public PSSecret() /// /// secret returned from service /// helper class - internal PSSecret(Azure.KeyVault.Models.SecretBundle secret, VaultUriHelper vaultUriHelper) + internal PSKeyVaultSecret(Azure.KeyVault.Models.SecretBundle secret, VaultUriHelper vaultUriHelper) { if (secret == null) throw new ArgumentNullException("secret"); @@ -36,7 +36,7 @@ internal PSSecret(Azure.KeyVault.Models.SecretBundle secret, VaultUriHelper vaul if (secret.Value != null) SecretValue = secret.Value.ConvertToSecureString(); - Attributes = new PSSecretAttributes( + Attributes = new PSKeyVaultSecretAttributes( secret.Attributes.Enabled, secret.Attributes.Expires, secret.Attributes.NotBefore, @@ -45,6 +45,14 @@ internal PSSecret(Azure.KeyVault.Models.SecretBundle secret, VaultUriHelper vaul secret.ContentType, secret.Attributes.RecoveryLevel, secret.Tags); + + Enabled = secret.Attributes.Enabled; + Expires = secret.Attributes.Expires; + NotBefore = secret.Attributes.NotBefore; + Created = secret.Attributes.Created; + Updated = secret.Attributes.Updated; + ContentType = secret.ContentType; + Tags = (secret.Tags == null) ? null : secret.Tags.ConvertToHashtable(); } public SecureString SecretValue { get; set; } @@ -59,7 +67,7 @@ public string SecretValueText return text; } } - public PSSecretAttributes Attributes { get; set; } + public PSKeyVaultSecretAttributes Attributes { get; set; } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretAttributes.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultSecretAttributes.cs similarity index 89% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretAttributes.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultSecretAttributes.cs index bb9ecb4d8d54..e2ba10fda481 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretAttributes.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultSecretAttributes.cs @@ -21,12 +21,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models /// /// Secret attributes from PSH perspective /// - public class PSSecretAttributes + public class PSKeyVaultSecretAttributes { - public PSSecretAttributes() + public PSKeyVaultSecretAttributes() { } - internal PSSecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string contentType, Hashtable tags) + internal PSKeyVaultSecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, string contentType, Hashtable tags) { this.Enabled = enabled; this.Expires = expires; @@ -35,7 +35,7 @@ internal PSSecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefor this.Tags = tags; } - internal PSSecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, + internal PSKeyVaultSecretAttributes(bool? enabled, DateTime? expires, DateTime? notBefore, DateTime? created, DateTime? updated, string contentType, string deletionRecoveryLevel, IDictionary tags) { this.Enabled = enabled; @@ -83,7 +83,7 @@ public Dictionary TagsDictionary } } - public static explicit operator Azure.KeyVault.Models.SecretAttributes(PSSecretAttributes attr) + public static explicit operator Azure.KeyVault.Models.SecretAttributes(PSKeyVaultSecretAttributes attr) { return new Azure.KeyVault.Models.SecretAttributes { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretIdentityItem.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultSecretIdentityItem.cs similarity index 86% rename from src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretIdentityItem.cs rename to src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultSecretIdentityItem.cs index 2843ebe7843c..9c7ea1e3a1bb 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSSecretIdentityItem.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/PSKeyVaultSecretIdentityItem.cs @@ -18,9 +18,12 @@ namespace Microsoft.Azure.Commands.KeyVault.Models { - public class PSSecretIdentityItem : ObjectIdentifier + public class PSKeyVaultSecretIdentityItem : ObjectIdentifier { - internal PSSecretIdentityItem(Azure.KeyVault.Models.SecretItem secretItem, VaultUriHelper vaultUriHelper) + public PSKeyVaultSecretIdentityItem() + { } + + internal PSKeyVaultSecretIdentityItem(Azure.KeyVault.Models.SecretItem secretItem, VaultUriHelper vaultUriHelper) { if (secretItem == null) throw new ArgumentNullException("secretItem"); @@ -39,7 +42,7 @@ internal PSSecretIdentityItem(Azure.KeyVault.Models.SecretItem secretItem, Vault Tags = (secretItem.Tags == null) ? null : secretItem.Tags.ConvertToHashtable(); } - internal PSSecretIdentityItem(PSSecret secret) + internal PSKeyVaultSecretIdentityItem(PSKeyVaultSecret secret) { if (secret == null) throw new ArgumentNullException("secret"); @@ -61,9 +64,9 @@ internal PSSecretIdentityItem(PSSecret secret) public DateTime? NotBefore { get; set; } - public DateTime? Created { get; private set; } + public DateTime? Created { get; protected set; } - public DateTime? Updated { get; private set; } + public DateTime? Updated { get; protected set; } public string ContentType { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/VaultManagementClient.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/VaultManagementClient.cs index 2cec45d4be89..8a5c9f749c7c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Models/VaultManagementClient.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Models/VaultManagementClient.cs @@ -57,7 +57,7 @@ private IKeyVaultManagementClient KeyVaultManagementClient /// vault creation parameters /// the active directory client /// - public PSVault CreateNewVault(VaultCreationParameters parameters, ActiveDirectoryClient adClient = null) + public PSKeyVault CreateNewVault(VaultCreationParameters parameters, ActiveDirectoryClient adClient = null) { if (parameters == null) throw new ArgumentNullException("parameters"); @@ -104,7 +104,7 @@ public PSVault CreateNewVault(VaultCreationParameters parameters, ActiveDirector Properties = properties }); - return new PSVault(response, adClient); + return new PSKeyVault(response, adClient); } /// @@ -114,7 +114,7 @@ public PSVault CreateNewVault(VaultCreationParameters parameters, ActiveDirector /// resource group name /// the active directory client /// the retrieved vault - public PSVault GetVault(string vaultName, string resourceGroupName, ActiveDirectoryClient adClient = null) + public PSKeyVault GetVault(string vaultName, string resourceGroupName, ActiveDirectoryClient adClient = null) { if (string.IsNullOrWhiteSpace(vaultName)) throw new ArgumentNullException("vaultName"); @@ -125,7 +125,7 @@ public PSVault GetVault(string vaultName, string resourceGroupName, ActiveDirect { var response = this.KeyVaultManagementClient.Vaults.Get(resourceGroupName, vaultName); - return new PSVault(response, adClient); + return new PSKeyVault(response, adClient); } catch (CloudException ce) { @@ -146,7 +146,7 @@ public PSVault GetVault(string vaultName, string resourceGroupName, ActiveDirect /// enabled for disk encryption /// the active directory client /// the updated vault - public PSVault UpdateVault(PSVault existingVault, PSVaultAccessPolicy[] updatedPolicies, bool? updatedEnabledForDeployment, + public PSKeyVault UpdateVault(PSKeyVault existingVault, PSKeyVaultAccessPolicy[] updatedPolicies, bool? updatedEnabledForDeployment, bool? updatedEnabledForTemplateDeployment, bool? updatedEnabledForDiskEncryption, ActiveDirectoryClient adClient = null) { if (existingVault == null) @@ -186,7 +186,7 @@ public PSVault UpdateVault(PSVault existingVault, PSVaultAccessPolicy[] updatedP Tags = TagsConversionHelper.CreateTagDictionary(existingVault.Tags, validate: true) } ); - return new PSVault(response, adClient); + return new PSKeyVault(response, adClient); } /// @@ -243,7 +243,7 @@ public void PurgeVault(string vaultName, string location) /// vault name /// resource group name /// the retrieved deleted vault. Null if vault is not found. - public PSDeletedVault GetDeletedVault(string vaultName, string location) + public PSDeletedKeyVault GetDeletedVault(string vaultName, string location) { if (string.IsNullOrWhiteSpace(vaultName)) throw new ArgumentNullException(nameof(vaultName)); @@ -254,7 +254,7 @@ public PSDeletedVault GetDeletedVault(string vaultName, string location) { var response = this.KeyVaultManagementClient.Vaults.GetDeleted(vaultName, location); - return new PSDeletedVault(response); + return new PSDeletedKeyVault(response); } catch (CloudException ce) { @@ -269,15 +269,15 @@ public PSDeletedVault GetDeletedVault(string vaultName, string location) /// Lists deleted vault in a subscription. /// /// the retrieved deleted vault - public List ListDeletedVaults() + public List ListDeletedVaults() { - List deletedVaults = new List(); + List deletedVaults = new List(); var response = this.KeyVaultManagementClient.Vaults.ListDeleted(); foreach (var deletedVault in response) { - deletedVaults.Add(new PSDeletedVault(deletedVault)); + deletedVaults.Add(new PSDeletedKeyVault(deletedVault)); } while (response?.NextPageLink != null) @@ -286,7 +286,7 @@ public List ListDeletedVaults() foreach (var deletedVault in response) { - deletedVaults.Add(new PSDeletedVault(deletedVault)); + deletedVaults.Add(new PSDeletedKeyVault(deletedVault)); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md index 5a9786e8fcba..2822c6a03a0f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md @@ -21,7 +21,7 @@ Add-AzureKeyVaultCertificateContact [-VaultName] [-EmailAddress] [-EmailAddress] [-PassThru] +Add-AzureKeyVaultCertificateContact [-InputObject] [-EmailAddress] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -81,7 +81,7 @@ Accept wildcard characters: False KeyVault object. ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: ByObject Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultKey.md index 9aeb53b010ae..90a04cd94116 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultKey.md @@ -30,14 +30,14 @@ Add-AzureKeyVaultKey [-VaultName] [-Name] -KeyFilePath [-Name] -Destination [-Disable] +Add-AzureKeyVaultKey [-InputObject] [-Name] -Destination [-Disable] [-KeyOps ] [-Expires ] [-NotBefore ] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### InputObjectImport ``` -Add-AzureKeyVaultKey [-InputObject] [-Name] -KeyFilePath +Add-AzureKeyVaultKey [-InputObject] [-Name] -KeyFilePath [-KeyFilePassword ] [-Destination ] [-Disable] [-KeyOps ] [-Expires ] [-NotBefore ] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] @@ -255,7 +255,7 @@ Accept wildcard characters: False Vault object. ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: InputObjectCreate, InputObjectImport Aliases: @@ -440,7 +440,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultKey ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md index 401435abfbe5..1c8b7c4faeb7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md @@ -21,7 +21,7 @@ Backup-AzureKeyVaultKey [-VaultName] [-Name] [[-OutputFile] [[-OutputFile] ] [-Force] +Backup-AzureKeyVaultKey [-InputObject] [[-OutputFile] ] [-Force] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -98,7 +98,7 @@ Accept wildcard characters: False Key bundle to back up, pipelined in from the output of a retrieval call. ```yaml -Type: PSKeyBundle +Type: PSKeyVaultKeyIdentityItem Parameter Sets: ByKey Aliases: Key diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md index 882b0d5deca9..2d81cedf2d79 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md @@ -21,7 +21,7 @@ Backup-AzureKeyVaultSecret [-VaultName] [-Name] [[-OutputFile] ### BySecret ``` -Backup-AzureKeyVaultSecret [-InputObject] [[-OutputFile] ] [-Force] +Backup-AzureKeyVaultSecret [-InputObject] [[-OutputFile] ] [-Force] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -96,7 +96,7 @@ Accept wildcard characters: False Secret to be backed up, pipelined in from the output of a retrieval call. ```yaml -Type: PSSecret +Type: PSKeyVaultSecretIdentityItem Parameter Sets: BySecret Aliases: Secret diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificate.md index 5fb855d3530b..c79ad4ac98e3 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificate.md @@ -33,19 +33,19 @@ Get-AzureKeyVaultCertificate [-VaultName] [-Name] [-IncludeVer ### ByNameInputObject ``` -Get-AzureKeyVaultCertificate [-InputObject] [[-Name] ] [-InRemovedState] +Get-AzureKeyVaultCertificate [-InputObject] [[-Name] ] [-InRemovedState] [-DefaultProfile ] [] ``` ### ByCertificateNameAndVersionInputObject ``` -Get-AzureKeyVaultCertificate [-InputObject] [-Name] [-Version] +Get-AzureKeyVaultCertificate [-InputObject] [-Name] [-Version] [-DefaultProfile ] [] ``` ### ByCertificateAllVersionsInputObject ``` -Get-AzureKeyVaultCertificate [-InputObject] [-Name] [-IncludeVersions] +Get-AzureKeyVaultCertificate [-InputObject] [-Name] [-IncludeVersions] [-DefaultProfile ] [] ``` @@ -136,7 +136,7 @@ Accept wildcard characters: False KeyVault object. ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: ByNameInputObject, ByCertificateNameAndVersionInputObject, ByCertificateAllVersionsInputObject Aliases: @@ -226,7 +226,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSCertificateIdentityItem] +### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateIdentityItem] ### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificate diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateContact.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateContact.md index 9cddda225bdd..2f98bf2770af 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateContact.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateContact.md @@ -21,7 +21,7 @@ Get-AzureKeyVaultCertificateContact [-VaultName] [-DefaultProfile [-DefaultProfile ] +Get-AzureKeyVaultCertificateContact [-InputObject] [-DefaultProfile ] [] ``` @@ -64,7 +64,7 @@ Accept wildcard characters: False KeyVault object. ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: ByInputObject Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateIssuer.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateIssuer.md index c4bef63f770b..2294438d5815 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateIssuer.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateIssuer.md @@ -21,7 +21,7 @@ Get-AzureKeyVaultCertificateIssuer [-VaultName] [[-Name] ] ### ByInputObject ``` -Get-AzureKeyVaultCertificateIssuer [-InputObject] [[-Name] ] +Get-AzureKeyVaultCertificateIssuer [-InputObject] [[-Name] ] [-DefaultProfile ] [] ``` @@ -63,7 +63,7 @@ Accept wildcard characters: False KeyVault object. ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: ByInputObject Aliases: @@ -111,7 +111,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### List, Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateIssuer +### List, Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateIssuer ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateOperation.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateOperation.md index 28a62f8dbfac..3f14983eda55 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateOperation.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificateOperation.md @@ -21,7 +21,7 @@ Get-AzureKeyVaultCertificateOperation [-VaultName] [-Name] ### ByInputObject ``` -Get-AzureKeyVaultCertificateOperation [-InputObject] +Get-AzureKeyVaultCertificateOperation [-InputObject] [-DefaultProfile ] [] ``` @@ -68,7 +68,7 @@ Accept wildcard characters: False Certificate Object. ```yaml -Type: PSKeyVaultCertificate +Type: PSKeyVaultCertificateIdentityItem Parameter Sets: ByInputObject Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificatePolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificatePolicy.md index 773f0512c055..144ec00199e0 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificatePolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultCertificatePolicy.md @@ -21,7 +21,7 @@ Get-AzureKeyVaultCertificatePolicy [-VaultName] [-Name] ### InputObject ``` -Get-AzureKeyVaultCertificatePolicy [-InputObject] +Get-AzureKeyVaultCertificatePolicy [-InputObject] [-DefaultProfile ] [] ``` @@ -74,7 +74,7 @@ Accept wildcard characters: False Certificate Object. ```yaml -Type: PSKeyVaultCertificate +Type: PSKeyVaultCertificateIdentityItem Parameter Sets: InputObject Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultKey.md index ebfe0303fa31..235d9253814f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultKey.md @@ -33,19 +33,19 @@ Get-AzureKeyVaultKey [-VaultName] [-Name] [-IncludeVersions] ### ByInputObjectVaultName ``` -Get-AzureKeyVaultKey [-InputObject] [[-Name] ] [-InRemovedState] +Get-AzureKeyVaultKey [-InputObject] [[-Name] ] [-InRemovedState] [-DefaultProfile ] [] ``` ### ByInputObjectKeyName ``` -Get-AzureKeyVaultKey [-InputObject] [-Name] [-Version] +Get-AzureKeyVaultKey [-InputObject] [-Name] [-Version] [-DefaultProfile ] [] ``` ### ByKInputObjecteyVersions ``` -Get-AzureKeyVaultKey [-InputObject] [-Name] [-IncludeVersions] +Get-AzureKeyVaultKey [-InputObject] [-Name] [-IncludeVersions] [-DefaultProfile ] [] ``` @@ -139,7 +139,7 @@ Accept wildcard characters: False KeyVault object. ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: ByInputObjectVaultName, ByInputObjectKeyName, ByKInputObjecteyVersions Aliases: @@ -233,7 +233,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### List, Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle, List, Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyBundle +### List, Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultKey, List, Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVaultKey ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultSecret.md index 3ee30251d8c3..4a0a77659a25 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureKeyVaultSecret.md @@ -33,19 +33,19 @@ Get-AzureKeyVaultSecret [-VaultName] [-Name] [-IncludeVersions ### ByInputObjectVaultName ``` -Get-AzureKeyVaultSecret [-InputObject] [[-Name] ] [-InRemovedState] +Get-AzureKeyVaultSecret [-InputObject] [[-Name] ] [-InRemovedState] [-DefaultProfile ] [] ``` ### ByInputObjectSecretName ``` -Get-AzureKeyVaultSecret [-InputObject] [-Name] [-Version] +Get-AzureKeyVaultSecret [-InputObject] [-Name] [-Version] [-DefaultProfile ] [] ``` ### ByInputObjectSecretVersions ``` -Get-AzureKeyVaultSecret [-InputObject] [-Name] [-IncludeVersions] +Get-AzureKeyVaultSecret [-InputObject] [-Name] [-IncludeVersions] [-DefaultProfile ] [] ``` @@ -146,7 +146,7 @@ Accept wildcard characters: False KeyVault Object. ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: ByInputObjectVaultName, ByInputObjectSecretName, ByInputObjectSecretVersions Aliases: @@ -240,7 +240,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### List, Microsoft.Azure.Commands.KeyVault.Models.PSSecret, List, Microsoft.Azure.Commands.KeyVault.Models.PSDeletedSecret +### List, Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecret, List, Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVaultSecret ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md index 7c480e13ffe6..6d810dec9cef 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md @@ -202,13 +202,13 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSVault +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVault -### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSVaultIdentityItem] +### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultIdentityItem] -### Microsoft.Azure.Commands.KeyVault.Models.PSDeletedVault +### Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVault -### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSDeletedVault] +### System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVault] ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md index ac83995f65b6..3a05cf5cc198 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md @@ -243,7 +243,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSCertificateBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificate ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md index 5f842c97fdeb..8ffa678a04bb 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md @@ -242,7 +242,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSVault +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVault ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificate.md index fce4b90df66c..3a5b623d0810 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificate.md @@ -21,8 +21,8 @@ Remove-AzureKeyVaultCertificate [-VaultName] [-Name] [-InRemov ### ByObject ``` -Remove-AzureKeyVaultCertificate [-InputObject] [-InRemovedState] [-Force] [-PassThru] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Remove-AzureKeyVaultCertificate [-InputObject] [-InRemovedState] [-Force] + [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -90,7 +90,7 @@ Accept wildcard characters: False Certificate Object. ```yaml -Type: PSKeyVaultCertificate +Type: PSKeyVaultCertificateIdentityItem Parameter Sets: ByObject Aliases: @@ -203,7 +203,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSCertificateBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVaultCertificate ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateIssuer.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateIssuer.md index f25b970cc9d4..a667030a0f29 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateIssuer.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultCertificateIssuer.md @@ -21,8 +21,8 @@ Remove-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] [-F ### InputObject ``` -Remove-AzureKeyVaultCertificateIssuer [-InputObject] [-Force] [-PassThru] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Remove-AzureKeyVaultCertificateIssuer [-InputObject] [-Force] + [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -73,7 +73,7 @@ Accept wildcard characters: False Certificate Issuer Object ```yaml -Type: PSKeyVaultCertificateIssuer +Type: PSKeyVaultCertificateIssuerIdentityItem Parameter Sets: InputObject Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultKey.md index 845e792cc7e2..f5488552f2e1 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultKey.md @@ -21,7 +21,7 @@ Remove-AzureKeyVaultKey [-VaultName] [-Name] [-Force] [-PassTh ### ByInputObject ``` -Remove-AzureKeyVaultKey [-InputObject] [-Force] [-PassThru] [-InRemovedState] +Remove-AzureKeyVaultKey [-InputObject] [-Force] [-PassThru] [-InRemovedState] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -100,7 +100,7 @@ Accept wildcard characters: False KeyBundle Object ```yaml -Type: PSKeyBundle +Type: PSKeyVaultKeyIdentityItem Parameter Sets: ByInputObject Aliases: @@ -215,7 +215,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVaultKey This cmdlet returns a value only if you specify the *PassThru* parameter. ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultSecret.md index 94d37eed77b8..67dd75feac1c 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureKeyVaultSecret.md @@ -20,7 +20,7 @@ Remove-AzureKeyVaultSecret [-VaultName] [-Name] [-Force] [-Pas ### ByInputObject ``` -Remove-AzureKeyVaultSecret [-InputObject] [-Force] [-PassThru] [-InRemovedState] +Remove-AzureKeyVaultSecret [-InputObject] [-Force] [-PassThru] [-InRemovedState] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -90,7 +90,7 @@ Accept wildcard characters: False Key Vault Secret Object ```yaml -Type: PSSecret +Type: PSKeyVaultSecretIdentityItem Parameter Sets: ByInputObject Aliases: @@ -205,7 +205,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSDeletedSecret +### Microsoft.Azure.Commands.KeyVault.Models.PSDeletedKeyVaultSecret This cmdlet returns a value only if you specify the *PassThru* parameter. ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md index d3b3fbc0ecae..b40b79d7c3b7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md @@ -16,25 +16,25 @@ Deletes a key vault. ### ByAvailableVault (Default) ``` Remove-AzureRmKeyVault [-VaultName] [[-ResourceGroupName] ] [[-Location] ] [-Force] - [-AsJob] [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-AsJob] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### ByDeletedVault ``` Remove-AzureRmKeyVault [-VaultName] [-Location] [-InRemovedState] [-Force] [-AsJob] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### InputObjectByAvailableVault ``` -Remove-AzureRmKeyVault [-InputObject] [[-Location] ] [-Force] [-AsJob] +Remove-AzureRmKeyVault [-InputObject] [[-Location] ] [-Force] [-AsJob] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### InputObjectByDeletedVault ``` -Remove-AzureRmKeyVault [-InputObject] [-Location] [-InRemovedState] [-Force] [-AsJob] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Remove-AzureRmKeyVault [-InputObject] [-Location] [-InRemovedState] [-Force] [-AsJob] + [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -112,7 +112,7 @@ Accept wildcard characters: False Key Vault object to be deleted. ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: InputObjectByAvailableVault, InputObjectByDeletedVault Aliases: @@ -165,6 +165,21 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` +### -PassThru +This Cmdlet does not return an object by default. If this switch is specified, it returns true if successful. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ResourceGroupName Specifies the name of a resource group. @@ -234,6 +249,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS +### System.Boolean + ## NOTES ## RELATED LINKS diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md index a82d2d75042a..990cfdf93ac7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md @@ -49,33 +49,33 @@ Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] < ### InputObjectByObjectId ``` -Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -ObjectId [-ApplicationId ] +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -ObjectId [-ApplicationId ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### InputObjectByServicePrincipalName ``` -Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -ServicePrincipalName [-PassThru] +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -ServicePrincipalName [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### InputObjectByUserPrincipalName ``` -Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -UserPrincipalName [-PassThru] +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -UserPrincipalName [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### InputObjectByEmail ``` -Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -EmailAddress [-PassThru] +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -EmailAddress [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### InputObjectForVault ``` -Remove-AzureRmKeyVaultAccessPolicy [-InputObject] [-DisableDeployment] [-DisableTemplateDeployment] - [-DisableDiskEncryption] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] [-DisableDeployment] + [-DisableTemplateDeployment] [-DisableDiskEncryption] [-PassThru] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -212,7 +212,7 @@ Accept wildcard characters: False Key Vault object. ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: InputObjectByObjectId, InputObjectByServicePrincipalName, InputObjectByUserPrincipalName, InputObjectByEmail, InputObjectForVault Aliases: @@ -355,7 +355,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSVault +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVault ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md index ee99bc5aca08..7297638c4447 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md @@ -21,7 +21,7 @@ Restore-AzureKeyVaultKey [-VaultName] [-InputFile] ### ByInputObject ``` -Restore-AzureKeyVaultKey [-InputObject] [-InputFile] +Restore-AzureKeyVaultKey [-InputObject] [-InputFile] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -80,7 +80,7 @@ Accept wildcard characters: False KeyVault object ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: ByInputObject Aliases: @@ -144,7 +144,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultKey ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md index d402278e5bbf..aa2b24d91d93 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md @@ -21,7 +21,7 @@ Restore-AzureKeyVaultSecret [-VaultName] [-InputFile] ### ByInputObject ``` -Restore-AzureKeyVaultSecret [-InputObject] [-InputFile] +Restore-AzureKeyVaultSecret [-InputObject] [-InputFile] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -77,10 +77,10 @@ Accept wildcard characters: False ``` ### -InputObject -KeyVault object` +KeyVault object -``yaml -Type: PSVault +```yaml +Type: PSKeyVault Parameter Sets: ByInputObject Aliases: @@ -144,7 +144,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSSecret +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecret ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateAttribute.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateAttribute.md index 4120ceeee1cd..16a126d3dff6 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateAttribute.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateAttribute.md @@ -22,7 +22,7 @@ Set-AzureKeyVaultCertificateAttribute [-VaultName] [-Name] [[- ### ByInputObject ``` -Set-AzureKeyVaultCertificateAttribute [-InputObject] [[-Version] ] +Set-AzureKeyVaultCertificateAttribute [-InputObject] [[-Version] ] [-Enable ] [-Tag ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -109,7 +109,7 @@ Accept wildcard characters: False Certificate object ```yaml -Type: PSKeyVaultCertificate +Type: PSKeyVaultCertificateIdentityItem Parameter Sets: ByInputObject Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md index 8e7417cc4430..174f2117dff2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md @@ -23,13 +23,14 @@ Set-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] [-Issu ### ByValue ``` -Set-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] -Issuer - [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Set-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] + -Issuer [-PassThru] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ### InputObjectExpanded ``` -Set-AzureKeyVaultCertificateIssuer [-InputObject] [-Name] [-IssuerProvider ] +Set-AzureKeyVaultCertificateIssuer [-InputObject] [-Name] [-IssuerProvider ] [-AccountId ] [-ApiKey ] [-OrganizationDetails ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] @@ -37,9 +38,9 @@ Set-AzureKeyVaultCertificateIssuer [-InputObject] [-Name] [-I ### InputObjectByValue ``` -Set-AzureKeyVaultCertificateIssuer [-InputObject] [-Name] - -Issuer [-PassThru] [-DefaultProfile ] [-WhatIf] - [-Confirm] [] +Set-AzureKeyVaultCertificateIssuer [-InputObject] [-Name] + -Issuer [-PassThru] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -105,7 +106,7 @@ Accept wildcard characters: False Key Vault Object ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: InputObjectExpanded, InputObjectByValue Aliases: @@ -120,7 +121,7 @@ Accept wildcard characters: False Specifies the certificate issuer to update. ```yaml -Type: PSKeyVaultCertificateIssuer +Type: PSKeyVaultCertificateIssuerIdentityItem Parameter Sets: ByValue, InputObjectByValue Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultKeyAttribute.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultKeyAttribute.md index e1c7beeaf625..de0c70bd77bb 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultKeyAttribute.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultKeyAttribute.md @@ -21,9 +21,9 @@ Set-AzureKeyVaultKeyAttribute [-VaultName] [-Name] [[-Version] ### InputObject ``` -Set-AzureKeyVaultKeyAttribute [-InputObject] [[-Version] ] [-Enable ] - [-Expires ] [-NotBefore ] [-KeyOps ] [-Tag ] [-PassThru] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Set-AzureKeyVaultKeyAttribute [-InputObject] [[-Version] ] + [-Enable ] [-Expires ] [-NotBefore ] [-KeyOps ] [-Tag ] + [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -109,7 +109,7 @@ Accept wildcard characters: False Key object ```yaml -Type: PSKeyBundle +Type: PSKeyVaultKeyIdentityItem Parameter Sets: InputObject Aliases: @@ -285,7 +285,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultKey ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecret.md index cf219e8ef89a..2769b1516f9a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecret.md @@ -22,7 +22,7 @@ Set-AzureKeyVaultSecret [-VaultName] [-Name] [-SecretValue] [-SecretValue] [-Disable] +Set-AzureKeyVaultSecret [-InputObject] [-SecretValue] [-Disable] [-Expires ] [-NotBefore ] [-ContentType ] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -136,7 +136,7 @@ Accept wildcard characters: False Secret object ```yaml -Type: PSSecret +Type: PSKeyVaultSecretIdentityItem Parameter Sets: InputObject Aliases: @@ -268,7 +268,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSSecret +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecret ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecretAttribute.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecretAttribute.md index ba475fe941aa..074c1b945727 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecretAttribute.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultSecretAttribute.md @@ -22,9 +22,9 @@ Set-AzureKeyVaultSecretAttribute [-VaultName] [-Name] [[-Versi ### InputObject ``` -Set-AzureKeyVaultSecretAttribute [-InputObject] [[-Version] ] [-Enable ] - [-Expires ] [-NotBefore ] [-ContentType ] [-Tag ] [-PassThru] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Set-AzureKeyVaultSecretAttribute [-InputObject] [[-Version] ] + [-Enable ] [-Expires ] [-NotBefore ] [-ContentType ] [-Tag ] + [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -153,7 +153,7 @@ Accept wildcard characters: False Secret object ```yaml -Type: PSSecret +Type: PSKeyVaultSecretIdentityItem Parameter Sets: InputObject Aliases: @@ -300,7 +300,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSSecret +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecret Returns Microsoft.Azure.Commands.KeyVault.Models.Secret object if PassThru is specified. Otherwise, returns nothing. ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureRmKeyVaultAccessPolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureRmKeyVaultAccessPolicy.md index 5cbeaf7afb52..3c000da755ba 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureRmKeyVaultAccessPolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureRmKeyVaultAccessPolicy.md @@ -54,7 +54,7 @@ Set-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] -ObjectId [-ApplicationId ] +Set-AzureRmKeyVaultAccessPolicy [-InputObject] -ObjectId [-ApplicationId ] [-PermissionsToKeys ] [-PermissionsToSecrets ] [-PermissionsToCertificates ] [-PermissionsToStorage ] [-BypassObjectIdValidation] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] @@ -62,7 +62,7 @@ Set-AzureRmKeyVaultAccessPolicy [-InputObject] -ObjectId [-Ap ### InputObjectByServicePrincipalName ``` -Set-AzureRmKeyVaultAccessPolicy [-InputObject] -ServicePrincipalName +Set-AzureRmKeyVaultAccessPolicy [-InputObject] -ServicePrincipalName [-PermissionsToKeys ] [-PermissionsToSecrets ] [-PermissionsToCertificates ] [-PermissionsToStorage ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] @@ -70,7 +70,7 @@ Set-AzureRmKeyVaultAccessPolicy [-InputObject] -ServicePrincipalName < ### InputObjectByUserPrincipalName ``` -Set-AzureRmKeyVaultAccessPolicy [-InputObject] -UserPrincipalName +Set-AzureRmKeyVaultAccessPolicy [-InputObject] -UserPrincipalName [-PermissionsToKeys ] [-PermissionsToSecrets ] [-PermissionsToCertificates ] [-PermissionsToStorage ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] @@ -78,14 +78,15 @@ Set-AzureRmKeyVaultAccessPolicy [-InputObject] -UserPrincipalName -EmailAddress [-PermissionsToKeys ] - [-PermissionsToSecrets ] [-PermissionsToCertificates ] [-PermissionsToStorage ] - [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Set-AzureRmKeyVaultAccessPolicy [-InputObject] -EmailAddress + [-PermissionsToKeys ] [-PermissionsToSecrets ] [-PermissionsToCertificates ] + [-PermissionsToStorage ] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] ``` ### InputObjectForVault ``` -Set-AzureRmKeyVaultAccessPolicy [-InputObject] [-EnabledForDeployment] +Set-AzureRmKeyVaultAccessPolicy [-InputObject] [-EnabledForDeployment] [-EnabledForTemplateDeployment] [-EnabledForDiskEncryption] [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -300,7 +301,7 @@ Accept wildcard characters: False Key Vault Object ```yaml -Type: PSVault +Type: PSKeyVault Parameter Sets: InputObjectByObjectId, InputObjectByServicePrincipalName, InputObjectByUserPrincipalName, InputObjectByEmailAddress, InputObjectForVault Aliases: @@ -557,7 +558,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSVault +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVault ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultCertificateRemoval.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultCertificateRemoval.md index 74819c2ac69a..6b8716c1c176 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultCertificateRemoval.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultCertificateRemoval.md @@ -20,7 +20,7 @@ Undo-AzureKeyVaultCertificateRemoval [-VaultName] [-Name] ### InputObject ``` -Undo-AzureKeyVaultCertificateRemoval [-InputObject] +Undo-AzureKeyVaultCertificateRemoval [-InputObject] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -59,7 +59,7 @@ Accept wildcard characters: False Deleted Certificate object ```yaml -Type: PSDeletedKeyVaultCertificate +Type: PSDeletedKeyVaultCertificateIdentityItem Parameter Sets: InputObject Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultKeyRemoval.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultKeyRemoval.md index cd2443dac01c..49c71eb872dd 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultKeyRemoval.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultKeyRemoval.md @@ -20,8 +20,8 @@ Undo-AzureKeyVaultKeyRemoval [-VaultName] [-Name] [-DefaultPro ### InputObject ``` -Undo-AzureKeyVaultKeyRemoval [-InputObject] [-DefaultProfile ] - [-WhatIf] [-Confirm] [] +Undo-AzureKeyVaultKeyRemoval [-InputObject] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -59,7 +59,7 @@ Accept wildcard characters: False Deleted key object ```yaml -Type: PSDeletedKeyBundle +Type: PSDeletedKeyVaultKeyIdentityItem Parameter Sets: InputObject Aliases: @@ -142,7 +142,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSKeyBundle +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultKey ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultSecretRemoval.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultSecretRemoval.md index c67569388cbd..69015c111c67 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultSecretRemoval.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureKeyVaultSecretRemoval.md @@ -20,8 +20,8 @@ Undo-AzureKeyVaultSecretRemoval [-VaultName] [-Name] ### InputObject ``` -Undo-AzureKeyVaultSecretRemoval [-InputObject] [-DefaultProfile ] - [-WhatIf] [-Confirm] [] +Undo-AzureKeyVaultSecretRemoval [-InputObject] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -59,7 +59,7 @@ Accept wildcard characters: False Deleted secret object ```yaml -Type: PSDeletedSecret +Type: PSDeletedKeyVaultSecretIdentityItem Parameter Sets: InputObject Aliases: @@ -142,7 +142,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSSecret +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultSecret ## NOTES diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureRmKeyVaultRemoval.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureRmKeyVaultRemoval.md index 308e05489286..48ac2d7a58e5 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureRmKeyVaultRemoval.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Undo-AzureRmKeyVaultRemoval.md @@ -20,7 +20,7 @@ Undo-AzureRmKeyVaultRemoval [-VaultName] [-ResourceGroupName] ### InputObject ``` -Undo-AzureRmKeyVaultRemoval [-InputObject] [-ResourceGroupName] [-Tag ] +Undo-AzureRmKeyVaultRemoval [-InputObject] [-ResourceGroupName] [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -60,7 +60,7 @@ Accept wildcard characters: False Deleted vault object ```yaml -Type: PSDeletedVault +Type: PSDeletedKeyVault Parameter Sets: InputObject Aliases: @@ -174,7 +174,7 @@ System.Collections.Hashtable ## OUTPUTS -### Microsoft.Azure.Commands.KeyVault.Models.PSVault +### Microsoft.Azure.Commands.KeyVault.Models.PSKeyVault ## NOTES From 785b964e4e29f94a16982cbcfdf5a1f580a8e1d1 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Thu, 1 Mar 2018 17:44:41 -0800 Subject: [PATCH 08/19] fix new policy --- .../NewAzureKeyVaultCertificatePolicy.cs | 50 +++++++------------ .../New-AzureKeyVaultCertificatePolicy.md | 45 ++++------------- 2 files changed, 28 insertions(+), 67 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs index 5b760a99dcf1..d3f2ebea5a53 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs @@ -26,17 +26,15 @@ namespace Microsoft.Azure.Commands.KeyVault /// [Cmdlet(VerbsCommon.New, CmdletNoun.AzureKeyVaultCertificatePolicy, SupportsShouldProcess = true, - DefaultParameterSetName = SubjectNameRenewNumberParameterSet, + DefaultParameterSetName = SubjectNameParameterSet, HelpUri = Constants.KeyVaultHelpUri)] [OutputType(typeof(PSKeyVaultCertificatePolicy))] public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase { #region Parameter Set Names - private const string SubjectNameRenewNumberParameterSet = "SubjectNameWithRenewDays"; - private const string DNSNamesRenewNumberParameterSet = "DNSNamesWithRenewDays"; - private const string SubjectNameRenewPercentParameterSet = "SubjectNameWithRenewPercent"; - private const string DNSNamesRenewPercentParameterSet = "DNSNamesWithRenewPercent"; + private const string SubjectNameParameterSet = "SubjectName"; + private const string DNSNamesParameterSet = "DNSNames"; #endregion @@ -56,20 +54,11 @@ public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, - ParameterSetName = SubjectNameRenewNumberParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the subject name of the certificate.")] - [Parameter(Mandatory = true, - Position = 1, - ParameterSetName = SubjectNameRenewPercentParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the subject name of the certificate.")] - [Parameter(Mandatory = false, - ParameterSetName = DNSNamesRenewNumberParameterSet, + ParameterSetName = SubjectNameParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the subject name of the certificate.")] [Parameter(Mandatory = false, - ParameterSetName = DNSNamesRenewPercentParameterSet, + ParameterSetName = DNSNamesParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the subject name of the certificate.")] public string SubjectName { get; set; } @@ -79,12 +68,7 @@ public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 1, - ParameterSetName = DNSNamesRenewNumberParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the DNS names in the certificate.")] - [Parameter(Mandatory = true, - Position = 1, - ParameterSetName = DNSNamesRenewPercentParameterSet, + ParameterSetName = DNSNamesParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the DNS names in the certificate.")] public List DnsNames { get; set; } @@ -93,11 +77,6 @@ public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// RenewAtNumberOfDaysBeforeExpiry /// [Parameter(Mandatory = false, - ParameterSetName = DNSNamesRenewNumberParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies how many days before expiry the automatic certificate renewal process begins.")] - [Parameter(Mandatory = false, - ParameterSetName = SubjectNameRenewNumberParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies how many days before expiry the automatic certificate renewal process begins.")] [ValidateRange(1, int.MaxValue)] @@ -106,12 +85,7 @@ public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// /// RenewAtPercentageLifetime /// - [Parameter(Mandatory = true, - ParameterSetName = DNSNamesRenewPercentParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the percentage of the lifetime after which the automatic process for the certificate renewal begins.")] - [Parameter(Mandatory = true, - ParameterSetName = SubjectNameRenewPercentParameterSet, + [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the percentage of the lifetime after which the automatic process for the certificate renewal begins.")] [ValidateRange(0, 99)] @@ -218,6 +192,7 @@ public override void ExecuteCmdlet() ValidateDnsNames(); ValidateKeyUsage(); ValidateEkus(); + ValidateBothPercentageAndNumberOfDaysAreNotPresent(); var policy = new PSKeyVaultCertificatePolicy { @@ -243,6 +218,15 @@ public override void ExecuteCmdlet() } } + private void ValidateBothPercentageAndNumberOfDaysAreNotPresent() + { + if (RenewAtNumberOfDaysBeforeExpiry != null && + RenewAtPercentageLifetime != null) + { + throw new ArgumentException("Both RenewAtNumberOfDaysBeforeExpiry and RenewAtPercentageLifetime cannot be specified."); + } + } + private void ValidateKeyUsage() { if (KeyUsage != null) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md index bd5473e518bb..ab01c34c32c6 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md @@ -13,45 +13,22 @@ Creates an in-memory certificate policy object. ## SYNTAX -### SubjectNameWithRenewDays (Default) +### SubjectName (Default) ``` New-AzureKeyVaultCertificatePolicy [-IssuerName] [-SubjectName] - [-RenewAtNumberOfDaysBeforeExpiry ] [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] - [-KeyUsage ] - [-Ekus ] [-ValidityInMonths ] - [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] - [-KeyType ] [-KeyNotExportable] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] -``` - -### SubjectNameWithRenewPercent -``` -New-AzureKeyVaultCertificatePolicy [-IssuerName] [-SubjectName] - -RenewAtPercentageLifetime [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] - [-KeyUsage ] + [-RenewAtNumberOfDaysBeforeExpiry ] [-RenewAtPercentageLifetime ] [-SecretContentType ] + [-ReuseKeyOnRenewal] [-Disabled] [-KeyUsage ] [-Ekus ] [-ValidityInMonths ] [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] [-KeyType ] [-KeyNotExportable] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` -### DNSNamesWithRenewDays +### DNSNames ``` New-AzureKeyVaultCertificatePolicy [-IssuerName] [[-SubjectName] ] [-DnsNames] [-RenewAtNumberOfDaysBeforeExpiry ] - [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] - [-KeyUsage ] - [-Ekus ] [-ValidityInMonths ] - [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] - [-KeyType ] [-KeyNotExportable] [-DefaultProfile ] [-WhatIf] [-Confirm] - [] -``` - -### DNSNamesWithRenewPercent -``` -New-AzureKeyVaultCertificatePolicy [-IssuerName] [[-SubjectName] ] - [-DnsNames] -RenewAtPercentageLifetime - [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] + [-RenewAtPercentageLifetime ] [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] [-KeyUsage ] [-Ekus ] [-ValidityInMonths ] [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] @@ -123,7 +100,7 @@ Specifies the DNS names in the certificate. ```yaml Type: System.Collections.Generic.List`1[System.String] -Parameter Sets: DNSNamesWithRenewDays, DNSNamesWithRenewPercent +Parameter Sets: DNSNames Aliases: Required: True @@ -248,7 +225,7 @@ Specifies the number of days before expiry after which the automatic process for ```yaml Type: Int32 -Parameter Sets: SubjectNameWithRenewDays, DNSNamesWithRenewDays +Parameter Sets: (All) Aliases: Required: False @@ -263,10 +240,10 @@ Specifies the percentage of the lifetime after which the automatic process for c ```yaml Type: Int32 -Parameter Sets: SubjectNameWithRenewPercent, DNSNamesWithRenewPercent +Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) @@ -313,7 +290,7 @@ Specifies the subject name of the certificate. ```yaml Type: String -Parameter Sets: SubjectNameWithRenewDays, SubjectNameWithRenewPercent +Parameter Sets: SubjectName Aliases: Required: True @@ -325,7 +302,7 @@ Accept wildcard characters: False ```yaml Type: String -Parameter Sets: DNSNamesWithRenewDays, DNSNamesWithRenewPercent +Parameter Sets: DNSNames Aliases: Required: False From 7f0735d4c3927a180d7cf75d18fe1c4a1848cf07 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Thu, 1 Mar 2018 17:47:28 -0800 Subject: [PATCH 09/19] update changelog --- src/ResourceManager/KeyVault/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ResourceManager/KeyVault/ChangeLog.md b/src/ResourceManager/KeyVault/ChangeLog.md index e271b1d85f7d..4029d712c4af 100644 --- a/src/ResourceManager/KeyVault/ChangeLog.md +++ b/src/ResourceManager/KeyVault/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Current Release +* Updated cmdlets to include piping scenarios ## Version 4.1.1 * Corrected usage of 'Login-AzureRmAccount' to use 'Connect-AzureRmAccount' From 86bdc9e779f04689e33b144ebb9c6e766b2ad151 Mon Sep 17 00:00:00 2001 From: Maddie Clayton Date: Thu, 1 Mar 2018 19:14:06 -0800 Subject: [PATCH 10/19] Update New-AzureRmKeyVault.md --- .../KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md index 8ffa678a04bb..6aae975d1173 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureRmKeyVault.md @@ -144,7 +144,9 @@ Accept wildcard characters: False ``` ### -Name -Specifies a name of the key vault to create. The name can be any combination of letters, digits, or hyphens. The name must start and end with a letter or digit. The name must be universally unique.```yaml +Specifies a name of the key vault to create. The name can be any combination of letters, digits, or hyphens. The name must start and end with a letter or digit. The name must be universally unique. + +```yaml Type: String Parameter Sets: (All) Aliases: VaultName From d6b7cd76dc3f329dcead3570b677a9051cbd43bf Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Fri, 2 Mar 2018 11:00:58 -0800 Subject: [PATCH 11/19] update breakingchanges.csv --- .../Commands/AddAzureKeyVaultCertificate.cs | 1 + .../Commands/GetAzureKeyVault.cs | 15 +- ...eKeyVaultCertificateOrganizationDetails.cs | 1 + .../help/Add-AzureKeyVaultCertificate.md | 2 +- .../help/Get-AzureRmKeyVault.md | 34 ++--- ...eKeyVaultCertificateOrganizationDetails.md | 2 +- .../Exceptions/BreakingChangeIssues.csv | 128 +++++++++++++++++- 7 files changed, 152 insertions(+), 31 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs index 270aeed3f3ec..196a646df76f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs @@ -55,6 +55,7 @@ public class AddAzureKeyVaultCertificate : KeyVaultCmdletBase /// [Parameter(Mandatory = false, ValueFromPipeline = true, + ValueFromPipelineByPropertyName = true, Position = 2, HelpMessage = "Specifies the certificate policy.")] [ValidateNotNull] diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs index bf8bf9939a81..0407937b9506 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVault.cs @@ -33,7 +33,6 @@ public class GetAzureKeyVault : KeyVaultManagementCmdletBase private const string GetVaultParameterSet = "GetVaultByName"; private const string GetDeletedVaultParameterSet = "ByDeletedVault"; - private const string ListVaultsByRGParameterSet = "ListVaultsByResourceGroup"; private const string ListVaultsBySubParameterSet = "ListAllVaultsInSubscription"; private const string ListDeletedVaultsParameterSet = "ListAllDeletedVaultsInSubscription"; @@ -44,7 +43,7 @@ public class GetAzureKeyVault : KeyVaultManagementCmdletBase /// /// Vault name /// - [Parameter(Mandatory = true, + [Parameter(Mandatory = false, ParameterSetName = GetVaultParameterSet, Position = 0, ValueFromPipelineByPropertyName = true, @@ -66,11 +65,6 @@ public class GetAzureKeyVault : KeyVaultManagementCmdletBase ParameterSetName = GetVaultParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the name of the resource group associated with the key vault being queried.")] - [Parameter(Mandatory = true, - Position = 0, - ParameterSetName = ListVaultsByRGParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the name of a resource group. This cmdlet gets key vault instances in the resource group that this parameter specifies.")] [ResourceGroupCompleter] [ValidateNotNullOrEmpty()] public string ResourceGroupName { get; set; } @@ -111,6 +105,12 @@ public override void ExecuteCmdlet() ResourceGroupName = string.IsNullOrWhiteSpace(ResourceGroupName) ? GetResourceGroupName(VaultName) : ResourceGroupName; PSKeyVault vault = null; + if (string.IsNullOrEmpty(VaultName)) + { + WriteObject(ListVaults(ResourceGroupName, Tag), true); + break; + } + if (!string.IsNullOrWhiteSpace(ResourceGroupName)) vault = KeyVaultManagementClient.GetVault( VaultName, @@ -119,7 +119,6 @@ public override void ExecuteCmdlet() WriteObject(vault); break; - case ListVaultsByRGParameterSet: case ListVaultsBySubParameterSet: WriteObject(ListVaults(ResourceGroupName, Tag), true); break; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateOrganizationDetails.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateOrganizationDetails.cs index bb1055448752..1408a9625779 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateOrganizationDetails.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificateOrganizationDetails.cs @@ -41,6 +41,7 @@ public class NewAzureKeyVaultCertificateOrganizationDetails : KeyVaultCmdletBase /// [Parameter(Mandatory = false, ValueFromPipeline = true, + ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the details of the administrators for the organization.")] public List AdministratorDetails { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md index f70bfec4995a..a757002f6e16 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md @@ -96,7 +96,7 @@ Aliases: InputObject Required: False Position: 2 Default value: None -Accept pipeline input: True (ByValue) +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md index 6d810dec9cef..8befcb6ff737 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Get-AzureRmKeyVault.md @@ -20,7 +20,7 @@ Get-AzureRmKeyVault [-Tag ] [-DefaultProfile ### GetVaultByName ``` -Get-AzureRmKeyVault [-VaultName] [[-ResourceGroupName] ] +Get-AzureRmKeyVault [[-VaultName] ] [[-ResourceGroupName] ] [-DefaultProfile ] [] ``` @@ -30,12 +30,6 @@ Get-AzureRmKeyVault [-VaultName] [-Location] [-InRemovedState] [-DefaultProfile ] [] ``` -### ListVaultsByResourceGroup -``` -Get-AzureRmKeyVault [-ResourceGroupName] [-DefaultProfile ] - [] -``` - ### ListAllDeletedVaultsInSubscription ``` Get-AzureRmKeyVault [-InRemovedState] [-DefaultProfile ] [] @@ -151,18 +145,6 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -```yaml -Type: String -Parameter Sets: ListVaultsByResourceGroup -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -Tag Key-value pairs in the form of a hash table. For example: @@ -185,7 +167,19 @@ Specifies the name of the key vault. ```yaml Type: String -Parameter Sets: GetVaultByName, ByDeletedVault +Parameter Sets: GetVaultByName +Aliases: Name + +Required: False +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +```yaml +Type: String +Parameter Sets: ByDeletedVault Aliases: Name Required: True diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateOrganizationDetails.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateOrganizationDetails.md index 17360bc450ca..930ae686dd25 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateOrganizationDetails.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificateOrganizationDetails.md @@ -47,7 +47,7 @@ Aliases: Required: False Position: Named Default value: None -Accept pipeline input: True (ByValue) +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` diff --git a/tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv index 1c12b793311c..a0156b0e10e3 100644 --- a/tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv +++ b/tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv @@ -867,4 +867,130 @@ "D:\azpwrSBDR\azure-powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.ServiceBus\Microsoft.Azure.Commands.ServiceBus.dll","Microsoft.Azure.Commands.ServiceBus.Commands.Topic.GetAzureRmServiceBusTopic","Get-AzureRmServiceBusTopic","0","2060","The position of parameter 'Name' has changed for parameter set '__AllParameterSets' for cmdlet 'Get-AzureRmServiceBusTopic'.","Revert the position change made to parameter 'Name' for parameter set '__AllParameterSets'." "D:\azpwrSBDR\azure-powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.ServiceBus\Microsoft.Azure.Commands.ServiceBus.dll","Microsoft.Azure.Commands.ServiceBus.Commands.Topic.NewAzureRmServiceBusTopic","New-AzureRmServiceBusTopic","0","2060","The position of parameter 'Name' has changed for parameter set '__AllParameterSets' for cmdlet 'New-AzureRmServiceBusTopic'.","Revert the position change made to parameter 'Name' for parameter set '__AllParameterSets'." "d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Resources\Microsoft.Azure.Commands.Resources.dll","Microsoft.Azure.Commands.ActiveDirectory.GetAzureADServicePrincipalCommand","Get-AzureRmADServicePrincipal","0","2100","The parameter 'ServicePrincipalName' in cmdlet 'Get-AzureRmADServicePrincipal' is no longer in the parameter set 'EmptyParameterSet'.","Add parameter 'ServicePrincipalName' back to the parameter set 'EmptyParameterSet'." -"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Resources\Microsoft.Azure.Commands.Resources.dll","Microsoft.Azure.Commands.ActiveDirectory.GetAzureADServicePrincipalCommand","Get-AzureRmADServicePrincipal","0","2100","The parameter 'DefaultProfile' in cmdlet 'Get-AzureRmADServicePrincipal' is no longer in the parameter set 'EmptyParameterSet'.","Add parameter 'DefaultProfile' back to the parameter set 'EmptyParameterSet'." \ No newline at end of file +"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Resources\Microsoft.Azure.Commands.Resources.dll","Microsoft.Azure.Commands.ActiveDirectory.GetAzureADServicePrincipalCommand","Get-AzureRmADServicePrincipal","0","2100","The parameter 'DefaultProfile' in cmdlet 'Get-AzureRmADServicePrincipal' is no longer in the parameter set 'EmptyParameterSet'.","Add parameter 'DefaultProfile' back to the parameter set 'EmptyParameterSet'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultCertificate","Add-AzureKeyVaultCertificate","0","1020","The cmdlet 'Add-AzureKeyVaultCertificate' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation'.","Make cmdlet 'Add-AzureKeyVaultCertificate' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultCertificate","Add-AzureKeyVaultCertificate","0","2020","The cmdlet 'Add-AzureKeyVaultCertificate' no longer supports the type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy' for parameter 'CertificatePolicy'.","Change the type for parameter 'CertificatePolicy' back to 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.BackupAzureKeyVaultSecret","Backup-AzureKeyVaultSecret","0","2020","The cmdlet 'Backup-AzureKeyVaultSecret' no longer supports the type 'Microsoft.Azure.Commands.KeyVault.Models.Secret' for parameter 'Secret'.","Change the type for parameter 'Secret' back to 'Microsoft.Azure.Commands.KeyVault.Models.Secret'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RestoreAzureKeyVaultSecret","Restore-AzureKeyVaultSecret","0","1020","The cmdlet 'Restore-AzureKeyVaultSecret' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'.","Make cmdlet 'Restore-AzureKeyVaultSecret' return type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RestoreAzureKeyVaultSecret","Restore-AzureKeyVaultSecret","0","2020","The cmdlet 'Restore-AzureKeyVaultSecret' no longer supports the type 'System.String' for parameter 'InputFile'.","Change the type for parameter 'InputFile' back to 'System.String'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RestoreAzureKeyVaultSecret","Restore-AzureKeyVaultSecret","0","2100","The parameter 'VaultName' in cmdlet 'Restore-AzureKeyVaultSecret' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificateAttribute","Set-AzureKeyVaultCertificateAttribute","0","1020","The cmdlet 'Set-AzureKeyVaultCertificateAttribute' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificate'.","Make cmdlet 'Set-AzureKeyVaultCertificateAttribute' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificate'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificateAttribute","Set-AzureKeyVaultCertificateAttribute","0","2100","The parameter 'VaultName' in cmdlet 'Set-AzureKeyVaultCertificateAttribute' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificateAttribute","Set-AzureKeyVaultCertificateAttribute","0","2100","The parameter 'Name' in cmdlet 'Set-AzureKeyVaultCertificateAttribute' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificateAttribute","Set-AzureKeyVaultCertificateAttribute","0","2100","The parameter 'Version' in cmdlet 'Set-AzureKeyVaultCertificateAttribute' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Version' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.StopAzureKeyVaultCertificateOperation","Stop-AzureKeyVaultCertificateOperation","0","1020","The cmdlet 'Stop-AzureKeyVaultCertificateOperation' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation'.","Make cmdlet 'Stop-AzureKeyVaultCertificateOperation' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.StopAzureKeyVaultCertificateOperation","Stop-AzureKeyVaultCertificateOperation","0","2100","The parameter 'VaultName' in cmdlet 'Stop-AzureKeyVaultCertificateOperation' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.StopAzureKeyVaultCertificateOperation","Stop-AzureKeyVaultCertificateOperation","0","2100","The parameter 'Name' in cmdlet 'Stop-AzureKeyVaultCertificateOperation' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificateOperation","Get-AzureKeyVaultCertificateOperation","0","1020","The cmdlet 'Get-AzureKeyVaultCertificateOperation' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation'.","Make cmdlet 'Get-AzureKeyVaultCertificateOperation' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificateOperation","Get-AzureKeyVaultCertificateOperation","0","2100","The parameter 'VaultName' in cmdlet 'Get-AzureKeyVaultCertificateOperation' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificateOperation","Get-AzureKeyVaultCertificateOperation","0","2100","The parameter 'Name' in cmdlet 'Get-AzureKeyVaultCertificateOperation' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.ImportAzureKeyVaultCertificate","Import-AzureKeyVaultCertificate","0","1020","The cmdlet 'Import-AzureKeyVaultCertificate' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificate'.","Make cmdlet 'Import-AzureKeyVaultCertificate' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificate'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.ImportAzureKeyVaultCertificate","Import-AzureKeyVaultCertificate","0","1050","The parameter set 'ImportWithPrivateKeyFromFile' for cmdlet 'Import-AzureKeyVaultCertificate' has been removed.","Add parameter set 'ImportWithPrivateKeyFromFile' back to cmdlet 'Import-AzureKeyVaultCertificate'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultCertificateContact","Add-AzureKeyVaultCertificateContact","0","1020","The cmdlet 'Add-AzureKeyVaultCertificateContact' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateContact]'.","Make cmdlet 'Add-AzureKeyVaultCertificateContact' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateContact]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultCertificateContact","Add-AzureKeyVaultCertificateContact","0","2020","The cmdlet 'Add-AzureKeyVaultCertificateContact' no longer supports the type 'System.String' for parameter 'EmailAddress'.","Change the type for parameter 'EmailAddress' back to 'System.String'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultCertificateContact","Add-AzureKeyVaultCertificateContact","0","1050","The parameter set 'Add' for cmdlet 'Add-AzureKeyVaultCertificateContact' has been removed.","Add parameter set 'Add' back to cmdlet 'Add-AzureKeyVaultCertificateContact'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificate","Get-AzureKeyVaultCertificate","0","1020","The cmdlet 'Get-AzureKeyVaultCertificate' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.CertificateIdentityItem]'.","Make cmdlet 'Get-AzureKeyVaultCertificate' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.CertificateIdentityItem]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificate","Get-AzureKeyVaultCertificate","0","1020","The cmdlet 'Get-AzureKeyVaultCertificate' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificate'.","Make cmdlet 'Get-AzureKeyVaultCertificate' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificate'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificate","Get-AzureKeyVaultCertificate","0","1020","The cmdlet 'Get-AzureKeyVaultCertificate' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyVaultCertificate'.","Make cmdlet 'Get-AzureKeyVaultCertificate' return type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyVaultCertificate'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificate","Get-AzureKeyVaultCertificate","0","1020","The cmdlet 'Get-AzureKeyVaultCertificate' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.DeletedCertificateIdentityItem]'.","Make cmdlet 'Get-AzureKeyVaultCertificate' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.DeletedCertificateIdentityItem]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificate","Get-AzureKeyVaultCertificate","0","2100","The parameter 'VaultName' in cmdlet 'Get-AzureKeyVaultCertificate' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificate","Get-AzureKeyVaultCertificate","0","1050","The parameter set 'ByCertificateName' for cmdlet 'Get-AzureKeyVaultCertificate' has been removed.","Add parameter set 'ByCertificateName' back to cmdlet 'Get-AzureKeyVaultCertificate'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificate","Get-AzureKeyVaultCertificate","0","1050","The parameter set 'ByCertificateVersions' for cmdlet 'Get-AzureKeyVaultCertificate' has been removed.","Add parameter set 'ByCertificateVersions' back to cmdlet 'Get-AzureKeyVaultCertificate'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificate","Get-AzureKeyVaultCertificate","0","1050","The parameter set 'ByDeletedCertificates' for cmdlet 'Get-AzureKeyVaultCertificate' has been removed.","Add parameter set 'ByDeletedCertificates' back to cmdlet 'Get-AzureKeyVaultCertificate'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificate","Get-AzureKeyVaultCertificate","0","1050","The parameter set 'ByVaultName' for cmdlet 'Get-AzureKeyVaultCertificate' has been removed.","Add parameter set 'ByVaultName' back to cmdlet 'Get-AzureKeyVaultCertificate'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificateContact","Get-AzureKeyVaultCertificateContact","0","1020","The cmdlet 'Get-AzureKeyVaultCertificateContact' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateContact]'.","Make cmdlet 'Get-AzureKeyVaultCertificateContact' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateContact]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificateIssuer","Get-AzureKeyVaultCertificateIssuer","0","1020","The cmdlet 'Get-AzureKeyVaultCertificateIssuer' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.CertificateIssuerIdentityItem]'.","Make cmdlet 'Get-AzureKeyVaultCertificateIssuer' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.CertificateIssuerIdentityItem]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificateIssuer","Get-AzureKeyVaultCertificateIssuer","0","1020","The cmdlet 'Get-AzureKeyVaultCertificateIssuer' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateIssuer'.","Make cmdlet 'Get-AzureKeyVaultCertificateIssuer' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateIssuer'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificateIssuer","Get-AzureKeyVaultCertificateIssuer","0","2100","The parameter 'VaultName' in cmdlet 'Get-AzureKeyVaultCertificateIssuer' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultCertificateIssuer","Get-AzureKeyVaultCertificateIssuer","0","1050","The parameter set 'ByVaultName' for cmdlet 'Get-AzureKeyVaultCertificateIssuer' has been removed.","Add parameter set 'ByVaultName' back to cmdlet 'Get-AzureKeyVaultCertificateIssuer'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.NewAzureKeyVaultCertificatePolicy","New-AzureKeyVaultCertificatePolicy","0","1020","The cmdlet 'New-AzureKeyVaultCertificatePolicy' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'.","Make cmdlet 'New-AzureKeyVaultCertificatePolicy' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.NewAzureKeyVaultCertificatePolicy","New-AzureKeyVaultCertificatePolicy","0","2150","A validate range has been added for parameter 'RenewAtNumberOfDaysBeforeExpiry' for cmdlet 'New-AzureKeyVaultCertificatePolicy'.","Remove the validate range from parameter 'RenewAtNumberOfDaysBeforeExpiry'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.NewAzureKeyVaultCertificatePolicy","New-AzureKeyVaultCertificatePolicy","0","2150","A validate range has been added for parameter 'RenewAtPercentageLifetime' for cmdlet 'New-AzureKeyVaultCertificatePolicy'.","Remove the validate range from parameter 'RenewAtPercentageLifetime'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.NewAzureKeyVaultCertificatePolicy","New-AzureKeyVaultCertificatePolicy","0","2100","The parameter 'SubjectName' in cmdlet 'New-AzureKeyVaultCertificatePolicy' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'SubjectName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.NewAzureKeyVaultCertificatePolicy","New-AzureKeyVaultCertificatePolicy","0","2100","The parameter 'DnsNames' in cmdlet 'New-AzureKeyVaultCertificatePolicy' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'DnsNames' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificate","Remove-AzureKeyVaultCertificate","0","2100","The parameter 'VaultName' in cmdlet 'Remove-AzureKeyVaultCertificate' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificate","Remove-AzureKeyVaultCertificate","0","2100","The parameter 'Name' in cmdlet 'Remove-AzureKeyVaultCertificate' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificateContact","Remove-AzureKeyVaultCertificateContact","0","1020","The cmdlet 'Remove-AzureKeyVaultCertificateContact' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateContact]'.","Make cmdlet 'Remove-AzureKeyVaultCertificateContact' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateContact]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificateContact","Remove-AzureKeyVaultCertificateContact","0","2020","The cmdlet 'Remove-AzureKeyVaultCertificateContact' no longer supports the type 'System.String' for parameter 'EmailAddress'.","Change the type for parameter 'EmailAddress' back to 'System.String'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificateContact","Remove-AzureKeyVaultCertificateContact","0","1050","The parameter set 'VaultName' for cmdlet 'Remove-AzureKeyVaultCertificateContact' has been removed.","Add parameter set 'VaultName' back to cmdlet 'Remove-AzureKeyVaultCertificateContact'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificateIssuer","Remove-AzureKeyVaultCertificateIssuer","0","1020","The cmdlet 'Remove-AzureKeyVaultCertificateIssuer' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateIssuer'.","Make cmdlet 'Remove-AzureKeyVaultCertificateIssuer' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateIssuer'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificateIssuer","Remove-AzureKeyVaultCertificateIssuer","0","2100","The parameter 'VaultName' in cmdlet 'Remove-AzureKeyVaultCertificateIssuer' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificateIssuer","Remove-AzureKeyVaultCertificateIssuer","0","2100","The parameter 'Name' in cmdlet 'Remove-AzureKeyVaultCertificateIssuer' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificateOperation","Remove-AzureKeyVaultCertificateOperation","0","1020","The cmdlet 'Remove-AzureKeyVaultCertificateOperation' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation'.","Make cmdlet 'Remove-AzureKeyVaultCertificateOperation' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOperation'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificateOperation","Remove-AzureKeyVaultCertificateOperation","0","2100","The parameter 'VaultName' in cmdlet 'Remove-AzureKeyVaultCertificateOperation' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultCertificateOperation","Remove-AzureKeyVaultCertificateOperation","0","2100","The parameter 'Name' in cmdlet 'Remove-AzureKeyVaultCertificateOperation' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificateIssuer","Set-AzureKeyVaultCertificateIssuer","0","1020","The cmdlet 'Set-AzureKeyVaultCertificateIssuer' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'.","Make cmdlet 'Set-AzureKeyVaultCertificateIssuer' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificateIssuer","Set-AzureKeyVaultCertificateIssuer","0","2020","The cmdlet 'Set-AzureKeyVaultCertificateIssuer' no longer supports the type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOrganizationDetails' for parameter 'OrganizationDetails'.","Change the type for parameter 'OrganizationDetails' back to 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOrganizationDetails'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificateIssuer","Set-AzureKeyVaultCertificateIssuer","0","2020","The cmdlet 'Set-AzureKeyVaultCertificateIssuer' no longer supports the type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateIssuer' for parameter 'Issuer'.","Change the type for parameter 'Issuer' back to 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateIssuer'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificateIssuer","Set-AzureKeyVaultCertificateIssuer","0","2100","The parameter 'VaultName' in cmdlet 'Set-AzureKeyVaultCertificateIssuer' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificatePolicy","Set-AzureKeyVaultCertificatePolicy","0","1020","The cmdlet 'Set-AzureKeyVaultCertificatePolicy' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'.","Make cmdlet 'Set-AzureKeyVaultCertificatePolicy' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificatePolicy","Set-AzureKeyVaultCertificatePolicy","0","1060","The parameter set 'Expanded' for cmdlet 'Set-AzureKeyVaultCertificatePolicy' is no longer the default parameter set.","Change the default parameter for cmdlet 'Set-AzureKeyVaultCertificatePolicy' back to 'Expanded'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificatePolicy","Set-AzureKeyVaultCertificatePolicy","0","2150","A validate range has been added for parameter 'RenewAtNumberOfDaysBeforeExpiry' for cmdlet 'Set-AzureKeyVaultCertificatePolicy'.","Remove the validate range from parameter 'RenewAtNumberOfDaysBeforeExpiry'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificatePolicy","Set-AzureKeyVaultCertificatePolicy","0","2150","A validate range has been added for parameter 'RenewAtPercentageLifetime' for cmdlet 'Set-AzureKeyVaultCertificatePolicy'.","Remove the validate range from parameter 'RenewAtPercentageLifetime'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificatePolicy","Set-AzureKeyVaultCertificatePolicy","0","2020","The cmdlet 'Set-AzureKeyVaultCertificatePolicy' no longer supports the type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy' for parameter 'CertificatePolicy'.","Change the type for parameter 'CertificatePolicy' back to 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificatePolicy","Set-AzureKeyVaultCertificatePolicy","0","1050","The parameter set 'Expanded' for cmdlet 'Set-AzureKeyVaultCertificatePolicy' has been removed.","Add parameter set 'Expanded' back to cmdlet 'Set-AzureKeyVaultCertificatePolicy'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultCertificatePolicy","Set-AzureKeyVaultCertificatePolicy","0","2030","The parameter 'CertificatePolicy' is no longer optional for the parameter set 'ByValue' for cmdlet 'Set-AzureKeyVaultCertificatePolicy'.","Make 'CertificatePolicy' optional for the parameter set 'ByValue'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultCertificateRemoval","Undo-AzureKeyVaultCertificateRemoval","0","2100","The parameter 'VaultName' in cmdlet 'Undo-AzureKeyVaultCertificateRemoval' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultCertificateRemoval","Undo-AzureKeyVaultCertificateRemoval","0","2100","The parameter 'Name' in cmdlet 'Undo-AzureKeyVaultCertificateRemoval' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultRemoval","Undo-AzureRmKeyVaultRemoval","0","1020","The cmdlet 'Undo-AzureRmKeyVaultRemoval' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'.","Make cmdlet 'Undo-AzureRmKeyVaultRemoval' return type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultRemoval","Undo-AzureRmKeyVaultRemoval","0","2100","The parameter 'VaultName' in cmdlet 'Undo-AzureRmKeyVaultRemoval' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultRemoval","Undo-AzureRmKeyVaultRemoval","0","2100","The parameter 'Location' in cmdlet 'Undo-AzureRmKeyVaultRemoval' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Location' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultKeyRemoval","Undo-AzureKeyVaultKeyRemoval","0","1020","The cmdlet 'Undo-AzureKeyVaultKeyRemoval' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'.","Make cmdlet 'Undo-AzureKeyVaultKeyRemoval' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultKeyRemoval","Undo-AzureKeyVaultKeyRemoval","0","2100","The parameter 'VaultName' in cmdlet 'Undo-AzureKeyVaultKeyRemoval' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultKeyRemoval","Undo-AzureKeyVaultKeyRemoval","0","2100","The parameter 'Name' in cmdlet 'Undo-AzureKeyVaultKeyRemoval' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultSecretRemoval","Undo-AzureKeyVaultSecretRemoval","0","1020","The cmdlet 'Undo-AzureKeyVaultSecretRemoval' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'.","Make cmdlet 'Undo-AzureKeyVaultSecretRemoval' return type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultSecretRemoval","Undo-AzureKeyVaultSecretRemoval","0","2100","The parameter 'VaultName' in cmdlet 'Undo-AzureKeyVaultSecretRemoval' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.UndoAzureKeyVaultSecretRemoval","Undo-AzureKeyVaultSecretRemoval","0","2100","The parameter 'Name' in cmdlet 'Undo-AzureKeyVaultSecretRemoval' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVault","Get-AzureRmKeyVault","0","1020","The cmdlet 'Get-AzureRmKeyVault' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'.","Make cmdlet 'Get-AzureRmKeyVault' return type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVault","Get-AzureRmKeyVault","0","1020","The cmdlet 'Get-AzureRmKeyVault' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSVaultIdentityItem]'.","Make cmdlet 'Get-AzureRmKeyVault' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSVaultIdentityItem]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVault","Get-AzureRmKeyVault","0","1020","The cmdlet 'Get-AzureRmKeyVault' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.PSDeletedVault'.","Make cmdlet 'Get-AzureRmKeyVault' return type 'Microsoft.Azure.Commands.KeyVault.Models.PSDeletedVault'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVault","Get-AzureRmKeyVault","0","1020","The cmdlet 'Get-AzureRmKeyVault' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSDeletedVault]'.","Make cmdlet 'Get-AzureRmKeyVault' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSDeletedVault]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.NewAzureKeyVault","New-AzureRmKeyVault","0","1020","The cmdlet 'New-AzureRmKeyVault' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'.","Make cmdlet 'New-AzureRmKeyVault' return type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVault","Remove-AzureRmKeyVault","0","2100","The parameter 'VaultName' in cmdlet 'Remove-AzureRmKeyVault' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVault","Remove-AzureRmKeyVault","0","2060","The position of parameter 'Location' has changed for parameter set 'ByDeletedVault' for cmdlet 'Remove-AzureRmKeyVault'.","Revert the position change made to parameter 'Location' for parameter set 'ByDeletedVault'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVault","Remove-AzureRmKeyVault","0","2030","The parameter 'InRemovedState' is no longer optional for the parameter set 'ByDeletedVault' for cmdlet 'Remove-AzureRmKeyVault'.","Make 'InRemovedState' optional for the parameter set 'ByDeletedVault'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultAccessPolicy","Remove-AzureRmKeyVaultAccessPolicy","0","1020","The cmdlet 'Remove-AzureRmKeyVaultAccessPolicy' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'.","Make cmdlet 'Remove-AzureRmKeyVaultAccessPolicy' return type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultAccessPolicy","Remove-AzureRmKeyVaultAccessPolicy","0","2100","The parameter 'VaultName' in cmdlet 'Remove-AzureRmKeyVaultAccessPolicy' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultAccessPolicy","Remove-AzureRmKeyVaultAccessPolicy","0","2100","The parameter 'ResourceGroupName' in cmdlet 'Remove-AzureRmKeyVaultAccessPolicy' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'ResourceGroupName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultAccessPolicy","Set-AzureRmKeyVaultAccessPolicy","0","1020","The cmdlet 'Set-AzureRmKeyVaultAccessPolicy' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'.","Make cmdlet 'Set-AzureRmKeyVaultAccessPolicy' return type 'Microsoft.Azure.Commands.KeyVault.Models.PSVault'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultAccessPolicy","Set-AzureRmKeyVaultAccessPolicy","0","2100","The parameter 'VaultName' in cmdlet 'Set-AzureRmKeyVaultAccessPolicy' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultAccessPolicy","Set-AzureRmKeyVaultAccessPolicy","0","2100","The parameter 'ResourceGroupName' in cmdlet 'Set-AzureRmKeyVaultAccessPolicy' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'ResourceGroupName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.BackupAzureKeyVaultKey","Backup-AzureKeyVaultKey","0","2020","The cmdlet 'Backup-AzureKeyVaultKey' no longer supports the type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle' for parameter 'Key'.","Change the type for parameter 'Key' back to 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.BackupAzureKeyVaultKey","Backup-AzureKeyVaultKey","0","2090","The ValidateNotNullOrEmpty attribute has been added to parameter 'Key' for cmdlet 'Backup-AzureKeyVaultKey'.","Remove the ValidateNotNullOrEmpty attribute from parameter 'Key'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultKey","Get-AzureKeyVaultKey","0","1020","The cmdlet 'Get-AzureKeyVaultKey' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyIdentityItem]'.","Make cmdlet 'Get-AzureKeyVaultKey' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyIdentityItem]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultKey","Get-AzureKeyVaultKey","0","1020","The cmdlet 'Get-AzureKeyVaultKey' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'.","Make cmdlet 'Get-AzureKeyVaultKey' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultKey","Get-AzureKeyVaultKey","0","1020","The cmdlet 'Get-AzureKeyVaultKey' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyIdentityItem]'.","Make cmdlet 'Get-AzureKeyVaultKey' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyIdentityItem]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultKey","Get-AzureKeyVaultKey","0","1020","The cmdlet 'Get-AzureKeyVaultKey' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyBundle'.","Make cmdlet 'Get-AzureKeyVaultKey' return type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyBundle'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultKey","Get-AzureKeyVaultKey","0","2030","The parameter 'Version' is no longer optional for the parameter set 'ByKeyName' for cmdlet 'Get-AzureKeyVaultKey'.","Make 'Version' optional for the parameter set 'ByKeyName'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultKey","Get-AzureKeyVaultKey","0","1050","The parameter set 'ByDeletedKey' for cmdlet 'Get-AzureKeyVaultKey' has been removed.","Add parameter set 'ByDeletedKey' back to cmdlet 'Get-AzureKeyVaultKey'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret","Get-AzureKeyVaultSecret","0","1020","The cmdlet 'Get-AzureKeyVaultSecret' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.SecretIdentityItem]'.","Make cmdlet 'Get-AzureKeyVaultSecret' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.SecretIdentityItem]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret","Get-AzureKeyVaultSecret","0","1020","The cmdlet 'Get-AzureKeyVaultSecret' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'.","Make cmdlet 'Get-AzureKeyVaultSecret' return type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret","Get-AzureKeyVaultSecret","0","1020","The cmdlet 'Get-AzureKeyVaultSecret' no longer has output type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.DeletedSecretIdentityItem]'.","Make cmdlet 'Get-AzureKeyVaultSecret' return type 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.DeletedSecretIdentityItem]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret","Get-AzureKeyVaultSecret","0","1020","The cmdlet 'Get-AzureKeyVaultSecret' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedSecret'.","Make cmdlet 'Get-AzureKeyVaultSecret' return type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedSecret'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret","Get-AzureKeyVaultSecret","0","2030","The parameter 'Version' is no longer optional for the parameter set 'BySecretName' for cmdlet 'Get-AzureKeyVaultSecret'.","Make 'Version' optional for the parameter set 'BySecretName'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret","Get-AzureKeyVaultSecret","0","1050","The parameter set 'ByDeletedSecrets' for cmdlet 'Get-AzureKeyVaultSecret' has been removed.","Add parameter set 'ByDeletedSecrets' back to cmdlet 'Get-AzureKeyVaultSecret'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultKey","Add-AzureKeyVaultKey","0","1020","The cmdlet 'Add-AzureKeyVaultKey' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'.","Make cmdlet 'Add-AzureKeyVaultKey' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultKey","Add-AzureKeyVaultKey","0","1050","The parameter set 'Create' for cmdlet 'Add-AzureKeyVaultKey' has been removed.","Add parameter set 'Create' back to cmdlet 'Add-AzureKeyVaultKey'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.AddAzureKeyVaultKey","Add-AzureKeyVaultKey","0","1050","The parameter set 'Import' for cmdlet 'Add-AzureKeyVaultKey' has been removed.","Add parameter set 'Import' back to cmdlet 'Add-AzureKeyVaultKey'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultKey","Remove-AzureKeyVaultKey","0","1020","The cmdlet 'Remove-AzureKeyVaultKey' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyBundle'.","Make cmdlet 'Remove-AzureKeyVaultKey' return type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedKeyBundle'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultKey","Remove-AzureKeyVaultKey","0","2100","The parameter 'VaultName' in cmdlet 'Remove-AzureKeyVaultKey' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultKey","Remove-AzureKeyVaultKey","0","2100","The parameter 'Name' in cmdlet 'Remove-AzureKeyVaultKey' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultSecret","Remove-AzureKeyVaultSecret","0","1020","The cmdlet 'Remove-AzureKeyVaultSecret' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedSecret'.","Make cmdlet 'Remove-AzureKeyVaultSecret' return type 'Microsoft.Azure.Commands.KeyVault.Models.DeletedSecret'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultSecret","Remove-AzureKeyVaultSecret","0","2100","The parameter 'VaultName' in cmdlet 'Remove-AzureKeyVaultSecret' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RemoveAzureKeyVaultSecret","Remove-AzureKeyVaultSecret","0","2100","The parameter 'Name' in cmdlet 'Remove-AzureKeyVaultSecret' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RestoreAzureKeyVaultKey","Restore-AzureKeyVaultKey","0","1020","The cmdlet 'Restore-AzureKeyVaultKey' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'.","Make cmdlet 'Restore-AzureKeyVaultKey' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RestoreAzureKeyVaultKey","Restore-AzureKeyVaultKey","0","2020","The cmdlet 'Restore-AzureKeyVaultKey' no longer supports the type 'System.String' for parameter 'InputFile'.","Change the type for parameter 'InputFile' back to 'System.String'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.RestoreAzureKeyVaultKey","Restore-AzureKeyVaultKey","0","2100","The parameter 'VaultName' in cmdlet 'Restore-AzureKeyVaultKey' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultKeyAttribute","Set-AzureKeyVaultKeyAttribute","0","1020","The cmdlet 'Set-AzureKeyVaultKeyAttribute' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'.","Make cmdlet 'Set-AzureKeyVaultKeyAttribute' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyBundle'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultKeyAttribute","Set-AzureKeyVaultKeyAttribute","0","2100","The parameter 'VaultName' in cmdlet 'Set-AzureKeyVaultKeyAttribute' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultKeyAttribute","Set-AzureKeyVaultKeyAttribute","0","2100","The parameter 'Name' in cmdlet 'Set-AzureKeyVaultKeyAttribute' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecret","Set-AzureKeyVaultSecret","0","1020","The cmdlet 'Set-AzureKeyVaultSecret' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'.","Make cmdlet 'Set-AzureKeyVaultSecret' return type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecret","Set-AzureKeyVaultSecret","0","2100","The parameter 'VaultName' in cmdlet 'Set-AzureKeyVaultSecret' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecret","Set-AzureKeyVaultSecret","0","2100","The parameter 'Name' in cmdlet 'Set-AzureKeyVaultSecret' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecretAttribute","Set-AzureKeyVaultSecretAttribute","0","1020","The cmdlet 'Set-AzureKeyVaultSecretAttribute' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'.","Make cmdlet 'Set-AzureKeyVaultSecretAttribute' return type 'Microsoft.Azure.Commands.KeyVault.Models.Secret'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecretAttribute","Set-AzureKeyVaultSecretAttribute","0","2100","The parameter 'VaultName' in cmdlet 'Set-AzureKeyVaultSecretAttribute' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'VaultName' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecretAttribute","Set-AzureKeyVaultSecretAttribute","0","2100","The parameter 'Name' in cmdlet 'Set-AzureKeyVaultSecretAttribute' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Name' back to the parameter set '__AllParameterSets'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.Commands.GetAzureKeyVaultCertificatePolicy","Get-AzureKeyVaultCertificatePolicy","0","1020","The cmdlet 'Get-AzureKeyVaultCertificatePolicy' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'.","Make cmdlet 'Get-AzureKeyVaultCertificatePolicy' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificatePolicy'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.Commands.NewAzureKeyVaultCertificateAdministratorDetails","New-AzureKeyVaultCertificateAdministratorDetails","0","1020","The cmdlet 'New-AzureKeyVaultCertificateAdministratorDetails' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails'.","Make cmdlet 'New-AzureKeyVaultCertificateAdministratorDetails' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.Commands.NewAzureKeyVaultCertificateOrganizationDetails","New-AzureKeyVaultCertificateOrganizationDetails","0","1020","The cmdlet 'New-AzureKeyVaultCertificateOrganizationDetails' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOrganizationDetails'.","Make cmdlet 'New-AzureKeyVaultCertificateOrganizationDetails' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOrganizationDetails'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.Commands.NewAzureKeyVaultCertificateOrganizationDetails","New-AzureKeyVaultCertificateOrganizationDetails","0","3030","The generic type for 'parameter AdministratorDetails' has been changed from 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails]' to 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateAdministratorDetails]'. ","Change the generic type for 'parameter AdministratorDetails' back to 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails]'." From 5e71f44abf6a77df10e97b5d50e22b22582298d4 Mon Sep 17 00:00:00 2001 From: Maddie Clayton Date: Fri, 2 Mar 2018 13:08:26 -0800 Subject: [PATCH 12/19] Update BreakingChangeIssues.csv --- tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv b/tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv index a0156b0e10e3..3f8669174aa9 100644 --- a/tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv +++ b/tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv @@ -994,3 +994,5 @@ "c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.Commands.NewAzureKeyVaultCertificateAdministratorDetails","New-AzureKeyVaultCertificateAdministratorDetails","0","1020","The cmdlet 'New-AzureKeyVaultCertificateAdministratorDetails' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails'.","Make cmdlet 'New-AzureKeyVaultCertificateAdministratorDetails' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails'." "c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.Commands.NewAzureKeyVaultCertificateOrganizationDetails","New-AzureKeyVaultCertificateOrganizationDetails","0","1020","The cmdlet 'New-AzureKeyVaultCertificateOrganizationDetails' no longer has output type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOrganizationDetails'.","Make cmdlet 'New-AzureKeyVaultCertificateOrganizationDetails' return type 'Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateOrganizationDetails'." "c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.Commands.NewAzureKeyVaultCertificateOrganizationDetails","New-AzureKeyVaultCertificateOrganizationDetails","0","3030","The generic type for 'parameter AdministratorDetails' has been changed from 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails]' to 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.PSKeyVaultCertificateAdministratorDetails]'. ","Change the generic type for 'parameter AdministratorDetails' back to 'System.Collections.Generic.List`1[Microsoft.Azure.Commands.KeyVault.Models.KeyVaultCertificateAdministratorDetails]'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVault","Get-AzureRmKeyVault","0","2060","The position of parameter 'Location' has changed for parameter set 'ByDeletedVault' for cmdlet 'Get-AzureRmKeyVault'.","Revert the position change made to parameter 'Location' for parameter set 'ByDeletedVault'." +"c:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.KeyVault\Microsoft.Azure.Commands.KeyVault.dll","Microsoft.Azure.Commands.KeyVault.GetAzureKeyVault","Get-AzureRmKeyVault","0","1050","The parameter set 'ListVaultsByResourceGroup' for cmdlet 'Get-AzureRmKeyVault' has been removed.","Add parameter set 'ListVaultsByResourceGroup' back to cmdlet 'Get-AzureRmKeyVault'." From 8d2d6546733bc467231a525667476fc06863cfb2 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Mon, 12 Mar 2018 13:44:49 -0700 Subject: [PATCH 13/19] fix comments --- .../AddAzureKeyVaultCertificateContact.cs | 67 +++++++++-------- .../Commands/GetAzureKeyVaultCertificate.cs | 17 ++--- .../RemoveAzureKeyVaultAccessPolicy.cs | 23 +++--- .../RemoveAzureKeyVaultCertificateContact.cs | 73 +++++++++---------- .../Commands/RestoreAzureKeyVaultKey.cs | 15 ++-- .../Commands/RestoreAzureKeyVaultSecret.cs | 23 +++--- .../SetAzureKeyVaultCertificatePolicy.cs | 2 +- .../Properties/Resources.Designer.cs | 6 +- 8 files changed, 104 insertions(+), 122 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs index bd48ab8591ca..bc48859621c1 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using System.Management.Automation; @@ -104,52 +105,50 @@ public override void ExecuteCmdlet() VaultName = parsedResourceId.ResourceName; } - foreach (String email in EmailAddress) + if (ShouldProcess(VaultName, Properties.Resources.AddCertificateContact)) { - if (ShouldProcess(email, Properties.Resources.AddCertificateContact)) - { - Contacts existingContacts; + Contacts existingContacts; - try + try + { + existingContacts = this.DataServiceClient.GetCertificateContacts(VaultName); + } + catch (KeyVaultErrorException exception) + { + if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound) { - existingContacts = this.DataServiceClient.GetCertificateContacts(VaultName); + throw; } - catch (KeyVaultErrorException exception) - { - if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound) - { - throw; - } - existingContacts = null; - } - - List newContactList; + existingContacts = null; + } - if (existingContacts == null || - existingContacts.ContactList == null) - { - newContactList = new List(); - } - else - { - newContactList = new List(existingContacts.ContactList); - } + List newContactList; + if (existingContacts == null || + existingContacts.ContactList == null) + { + newContactList = new List(); + } + else + { + newContactList = new List(existingContacts.ContactList); + } + + foreach (var email in EmailAddress) + { if (newContactList.FindIndex( - contact => (string.Compare(contact.EmailAddress, email, StringComparison.OrdinalIgnoreCase) == 0)) != -1) + contact => (string.Compare(contact.EmailAddress, email, StringComparison.OrdinalIgnoreCase) == 0)) == -1) { - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Provided email address '{0}' already exists.", email)); + newContactList.Add(new Contact { EmailAddress = email }); } + } - newContactList.Add(new Contact { EmailAddress = email }); - - var resultantContacts = this.DataServiceClient.SetCertificateContacts(VaultName, new Contacts { ContactList = newContactList }); + var resultantContacts = this.DataServiceClient.SetCertificateContacts(VaultName, new Contacts { ContactList = newContactList }); - if (PassThru.IsPresent) - { - this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts, VaultName), true); - } + if (PassThru.IsPresent) + { + this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts, VaultName), true); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs index 466c3d11ff64..5fd05d5a92bc 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificate.cs @@ -191,18 +191,15 @@ public override void ExecuteCmdlet() WriteObject(deletedCert); } } + else if (!string.IsNullOrEmpty(Name)) + { + certBundle = this.DataServiceClient.GetCertificate(VaultName, Name, string.Empty); + var certificate = PSKeyVaultCertificate.FromCertificateBundle(certBundle); + this.WriteObject(certificate); + } else { - if (string.IsNullOrEmpty(Name)) - { - GetAndWriteCertificates(VaultName); - } - else - { - certBundle = this.DataServiceClient.GetCertificate(VaultName, Name, string.Empty); - var certificate = PSKeyVaultCertificate.FromCertificateBundle(certBundle); - this.WriteObject(certificate); - } + GetAndWriteCertificates(VaultName); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs index 72fa9b962c8a..036f9df4b793 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultAccessPolicy.cs @@ -190,11 +190,11 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase [Parameter(Mandatory = true, ParameterSetName = ByEmail, ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the email address of the user in Azure Active Directory for which to grant permissions.")] + HelpMessage = "Specifies the email address of the user in Azure Active Directory whose permissions should be deleted.")] [Parameter(Mandatory = true, ParameterSetName = InputObjectByEmail, ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the email address of the user in Azure Active Directory for which to grant permissions.")] + HelpMessage = "Specifies the email address of the user in Azure Active Directory whose permissions should be deleted.")] [ValidateNotNullOrEmpty()] public string EmailAddress { get; set; } @@ -204,11 +204,11 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase [Parameter(Mandatory = false, ParameterSetName = ByObjectId, ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the ID of application that a user must.")] + HelpMessage = "Specifies the ID of application whose permissions should be removed.")] [Parameter(Mandatory = false, ParameterSetName = InputObjectByObjectId, ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the ID of application that a user must.")] + HelpMessage = "Specifies the ID of application whose permissions should be removed.")] public Guid? ApplicationId { get; set; } [Parameter(Mandatory = false, @@ -219,8 +219,7 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = InputObjectForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "If specified, disables the retrieval of secrets from this key vault by the Microsoft.Compute resource provider when referenced in resource creation.")] - [Alias("EnabledForDeployment")] - public SwitchParameter DisableDeployment { get; set; } + public SwitchParameter EnabledForDeployment { get; set; } [Parameter(Mandatory = false, ParameterSetName = ForVault, @@ -230,8 +229,7 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = InputObjectForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "If specified, disables the retrieval of secrets from this key vault by Azure Resource Manager when referenced in templates.")] - [Alias("EnabledForTemplateDeployment")] - public SwitchParameter DisableTemplateDeployment { get; set; } + public SwitchParameter EnabledForTemplateDeployment { get; set; } [Parameter(Mandatory = false, ParameterSetName = ForVault, @@ -241,8 +239,7 @@ public class RemoveAzureKeyVaultAccessPolicy : KeyVaultManagementCmdletBase ParameterSetName = InputObjectForVault, ValueFromPipelineByPropertyName = true, HelpMessage = "If specified, disables the retrieval of secrets from this key vault by Azure Disk Encryption.")] - [Alias("EnabledForDiskEncryption")] - public SwitchParameter DisableDiskEncryption { get; set; } + public SwitchParameter EnabledForDiskEncryption { get; set; } /// /// @@ -302,9 +299,9 @@ public override void ExecuteCmdlet() // Update the vault var updatedVault = KeyVaultManagementClient.UpdateVault(existingVault, updatedPolicies, - DisableDeployment.IsPresent ? false : existingVault.EnabledForDeployment, - DisableTemplateDeployment.IsPresent ? false : existingVault.EnabledForTemplateDeployment, - DisableDiskEncryption.IsPresent ? false : existingVault.EnabledForDiskEncryption, + EnabledForDeployment.IsPresent ? false : existingVault.EnabledForDeployment, + EnabledForTemplateDeployment.IsPresent ? false : existingVault.EnabledForTemplateDeployment, + EnabledForDiskEncryption.IsPresent ? false : existingVault.EnabledForDiskEncryption, ActiveDirectoryClient); if (PassThru.IsPresent) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs index e918681d6ee9..3fdf09acab95 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVaultCertificateContact.cs @@ -59,56 +59,51 @@ public class RemoveAzureKeyVaultCertificateContact : KeyVaultCmdletBase public override void ExecuteCmdlet() { - foreach (string email in EmailAddress) + if (ShouldProcess(VaultName, Properties.Resources.RemoveCertificateContact)) { - if (ShouldProcess(email, Properties.Resources.RemoveCertificateContact)) - { - Contacts existingContacts; + Contacts existingContacts; - try - { - existingContacts = this.DataServiceClient.GetCertificateContacts(VaultName); - } - catch (KeyVaultErrorException exception) + try + { + existingContacts = this.DataServiceClient.GetCertificateContacts(VaultName); + } + catch (KeyVaultErrorException exception) + { + if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound) { - if (exception.Response.StatusCode != System.Net.HttpStatusCode.NotFound) - { - throw; - } - - existingContacts = null; + throw; } - List existingContactList; + existingContacts = null; + } - if (existingContacts == null || - existingContacts.ContactList == null) - { - existingContactList = new List(); - } - else - { - existingContactList = new List(existingContacts.ContactList); - } + List existingContactList; - var nContactsRemoved = existingContactList.RemoveAll(contact => string.Compare(contact.EmailAddress, email, StringComparison.OrdinalIgnoreCase) == 0); + if (existingContacts == null || + existingContacts.ContactList == null) + { + existingContactList = new List(); + } + else + { + existingContactList = new List(existingContacts.ContactList); + } - if (nContactsRemoved == 0) - { - throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Provided email address '{0}' is not found.", EmailAddress)); - } + foreach (var email in EmailAddress) + { + existingContactList.RemoveAll(contact => string.Compare(contact.EmailAddress, email, StringComparison.OrdinalIgnoreCase) == 0); + } - if (existingContactList.Count == 0) - { - existingContactList = null; - } + if (existingContactList.Count == 0) + { + existingContactList = null; + } - var resultantContacts = this.DataServiceClient.SetCertificateContacts(VaultName, new Contacts { ContactList = existingContactList }); + var resultantContacts = this.DataServiceClient.SetCertificateContacts(VaultName, new Contacts { ContactList = existingContactList }); - if (PassThru.IsPresent) - { - this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts, VaultName)); - } + if (PassThru.IsPresent) + { + this.WriteObject(PSKeyVaultCertificateContact.FromKVCertificateContacts(resultantContacts, VaultName)); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs index accd35acaee4..4f4a1efa0ec7 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultKey.cs @@ -67,7 +67,7 @@ public class RestoreAzureKeyVaultKey : KeyVaultCmdletBase Position = 1, HelpMessage = "Input file. The input file containing the backed-up blob")] [ValidateNotNullOrEmpty] - public string[] InputFile { get; set; } + public string InputFile { get; set; } #endregion Input Parameter Definitions @@ -77,17 +77,14 @@ public override void ExecuteCmdlet() { VaultName = InputObject.VaultName; } - - foreach (var file in InputFile) + + if (ShouldProcess(VaultName, Properties.Resources.RestoreKey)) { - if (ShouldProcess(VaultName, Properties.Resources.RestoreKey)) - { - var filePath = ResolvePath(file); + var filePath = ResolvePath(InputFile); - var restoredKeyBundle = this.DataServiceClient.RestoreKey(VaultName, filePath); + var restoredKeyBundle = this.DataServiceClient.RestoreKey(VaultName, filePath); - this.WriteObject(restoredKeyBundle); - } + this.WriteObject(restoredKeyBundle); } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs index bf8ec17e5383..0e18f66df465 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RestoreAzureKeyVaultSecret.cs @@ -68,7 +68,7 @@ public class RestoreAzureKeyVaultSecret : KeyVaultCmdletBase Position = 1, HelpMessage = "Input file. The input file containing the backed-up blob" )] [ValidateNotNullOrEmpty] - public string[] InputFile { get; set; } + public string InputFile { get; set; } #endregion Input Parameter Definitions @@ -78,22 +78,19 @@ public override void ExecuteCmdlet( ) { VaultName = InputObject.VaultName; } - - foreach (var file in InputFile) + + if (ShouldProcess(VaultName, Properties.Resources.RestoreSecret)) { - if (ShouldProcess(VaultName, Properties.Resources.RestoreSecret)) - { - var resolvedFilePath = this.GetUnresolvedProviderPathFromPSPath(file); + var resolvedFilePath = this.GetUnresolvedProviderPathFromPSPath(InputFile); - if (!AzureSession.Instance.DataStore.FileExists(resolvedFilePath)) - { - throw new FileNotFoundException(string.Format(Resources.BackupSecretFileNotFound, resolvedFilePath)); - } + if (!AzureSession.Instance.DataStore.FileExists(resolvedFilePath)) + { + throw new FileNotFoundException(string.Format(Resources.BackupSecretFileNotFound, resolvedFilePath)); + } - var restoredSecret = this.DataServiceClient.RestoreSecret(VaultName, resolvedFilePath); + var restoredSecret = this.DataServiceClient.RestoreSecret(VaultName, resolvedFilePath); - this.WriteObject(restoredSecret); - } + this.WriteObject(restoredSecret); } } } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs index 57e7bdf63bb1..46dd5aee6c60 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs @@ -82,7 +82,7 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ExpandedRenewNumberParameterSet, - HelpMessage = "Specifies the number of days after which the automatic process for the certificate renewal begins.")] + HelpMessage = "Specifies the number of days before expiration when automatic renewal should start.")] [ValidateRange(1, int.MaxValue)] public int? RenewAtNumberOfDaysBeforeExpiry { get; set; } diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.Designer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.Designer.cs index 07737e3233c9..d82a23f66f4f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.Designer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.Designer.cs @@ -136,7 +136,7 @@ internal static string AllPermissionExpansionWarning { } /// - /// Looks up a localized string similar to No account found in the context. Please login using Login-AzureRMAccount.. + /// Looks up a localized string similar to No account found in the context. Please login using Connect-AzureRMAccount.. /// internal static string ArmAccountNotFound { get { @@ -469,7 +469,7 @@ internal static string InvalidSelectedSubscription { } /// - /// Looks up a localized string similar to Your Azure credentials have not been set up or have expired, please run Login-AzureRmAccount to set up your Azure credentials.. + /// Looks up a localized string similar to Your Azure credentials have not been set up or have expired, please run Connect-AzureRmAccount to set up your Azure credentials.. /// internal static string InvalidSubscriptionState { get { @@ -523,7 +523,7 @@ internal static string NoDefaultUserAccount { } /// - /// Looks up a localized string similar to No tenant found in the context. Please ensure that the credentials you provided are authorized to access an Azure subscription, then run Login-AzureRMAccount to login.. + /// Looks up a localized string similar to No tenant found in the context. Please ensure that the credentials you provided are authorized to access an Azure subscription, then run Connect-AzureRMAccount to login.. /// internal static string NoTenantInContext { get { From f4f69f2c4d742a1b2d59d8658c70ddf2ab87c41c Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Mon, 12 Mar 2018 13:51:08 -0700 Subject: [PATCH 14/19] update help --- .../Remove-AzureRmKeyVaultAccessPolicy.md | 48 +++++++++---------- .../help/Restore-AzureKeyVaultKey.md | 8 ++-- .../help/Restore-AzureKeyVaultSecret.md | 6 +-- .../Set-AzureKeyVaultCertificatePolicy.md | 2 +- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md index 990cfdf93ac7..b069e1064329 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVaultAccessPolicy.md @@ -42,9 +42,9 @@ Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] < ### ForVault ``` -Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] [-DisableDeployment] - [-DisableTemplateDeployment] [-DisableDiskEncryption] [-PassThru] [-DefaultProfile ] - [-WhatIf] [-Confirm] [] +Remove-AzureRmKeyVaultAccessPolicy [-VaultName] [[-ResourceGroupName] ] + [-EnabledForDeployment] [-EnabledForTemplateDeployment] [-EnabledForDiskEncryption] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### InputObjectByObjectId @@ -73,9 +73,9 @@ Remove-AzureRmKeyVaultAccessPolicy [-InputObject] -EmailAddress [-DisableDeployment] - [-DisableTemplateDeployment] [-DisableDiskEncryption] [-PassThru] [-DefaultProfile ] - [-WhatIf] [-Confirm] [] +Remove-AzureRmKeyVaultAccessPolicy [-InputObject] [-EnabledForDeployment] + [-EnabledForTemplateDeployment] [-EnabledForDiskEncryption] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -119,7 +119,7 @@ This command removes permission for the Microsoft.Compute resource provider to g ## PARAMETERS ### -ApplicationId -For future use. +Specifies the ID of application whose permissions should be removed ```yaml Type: Guid @@ -148,28 +148,28 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -DisableDeployment -If specified, disables the retrieval of secrets from this key vault by the Microsoft.Compute resource provider when referenced in resource creation. +### -EmailAddress +Specifies the user email address of the user whose access you want to remove. ```yaml -Type: SwitchParameter -Parameter Sets: ForVault, InputObjectForVault -Aliases: EnabledForDeployment +Type: String +Parameter Sets: ByEmail, InputObjectByEmail +Aliases: -Required: False +Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -DisableDiskEncryption -If specified, disables the retrieval of secrets from this key vault by Azure Disk Encryption. +### -EnabledForDeployment +If specified, disables the retrieval of secrets from this key vault by the Microsoft.Compute resource provider when referenced in resource creation. ```yaml Type: SwitchParameter Parameter Sets: ForVault, InputObjectForVault -Aliases: EnabledForDiskEncryption +Aliases: Required: False Position: Named @@ -178,13 +178,13 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -DisableTemplateDeployment -If specified, disables the retrieval of secrets from this key vault by Azure Resource Manager when referenced in templates. +### -EnabledForDiskEncryption +If specified, disables the retrieval of secrets from this key vault by Azure Disk Encryption. ```yaml Type: SwitchParameter Parameter Sets: ForVault, InputObjectForVault -Aliases: EnabledForTemplateDeployment +Aliases: Required: False Position: Named @@ -193,15 +193,15 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -EmailAddress -Specifies the user email address of the user whose access you want to remove. +### -EnabledForTemplateDeployment +If specified, disables the retrieval of secrets from this key vault by Azure Resource Manager when referenced in templates. ```yaml -Type: String -Parameter Sets: ByEmail, InputObjectByEmail +Type: SwitchParameter +Parameter Sets: ForVault, InputObjectForVault Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md index 7297638c4447..e22c165a305b 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultKey.md @@ -15,13 +15,13 @@ Creates a key in a key vault from a backed-up key. ### ByVaultName (Default) ``` -Restore-AzureKeyVaultKey [-VaultName] [-InputFile] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] +Restore-AzureKeyVaultKey [-VaultName] [-InputFile] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] ``` ### ByInputObject ``` -Restore-AzureKeyVaultKey [-InputObject] [-InputFile] +Restore-AzureKeyVaultKey [-InputObject] [-InputFile] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -65,7 +65,7 @@ Accept wildcard characters: False Specifies the input file that contains the backup of the key to restore. ```yaml -Type: String[] +Type: String Parameter Sets: (All) Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md index aa2b24d91d93..a01e6267217e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Restore-AzureKeyVaultSecret.md @@ -15,13 +15,13 @@ Creates a secret in a key vault from a backed-up secret. ### ByVaultName (Default) ``` -Restore-AzureKeyVaultSecret [-VaultName] [-InputFile] +Restore-AzureKeyVaultSecret [-VaultName] [-InputFile] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### ByInputObject ``` -Restore-AzureKeyVaultSecret [-InputObject] [-InputFile] +Restore-AzureKeyVaultSecret [-InputObject] [-InputFile] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -65,7 +65,7 @@ Accept wildcard characters: False Specifies the input file that contains the backup of the secret to restore. ```yaml -Type: String[] +Type: String Parameter Sets: (All) Aliases: diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md index 4ae1c5e8cb9f..43cd96941445 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md @@ -135,7 +135,7 @@ Accept wildcard characters: False ``` ### -EmailAtNumberOfDaysBeforeExpiry -Specifies how many days before expiry the automatic notification process begins. +Specifies the number of days before expiration when automatic renewal should start. ```yaml Type: Int32 From 795fbaa86770931f0a328a6808fda198d05901fc Mon Sep 17 00:00:00 2001 From: Maddie Clayton Date: Thu, 15 Mar 2018 12:58:46 -0700 Subject: [PATCH 15/19] Update RoleAssignmentTests.cs --- .../ScenarioTests/RoleAssignmentTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/RoleAssignmentTests.cs b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/RoleAssignmentTests.cs index 35e23c02ba32..c3a451946949 100644 --- a/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/RoleAssignmentTests.cs +++ b/src/ResourceManager/Resources/Commands.Resources.Test/ScenarioTests/RoleAssignmentTests.cs @@ -45,7 +45,7 @@ public void RaClassicAdmins() } [Fact] - [Trait(Category.AcceptanceType, Category.CheckIn)] + [Trait(Category.AcceptanceType, Category.Flaky)] public void RaPropertiesValidation() { ResourcesController.NewInstance.RunPsTest("Test-RaPropertiesValidation"); } From 2319a026fb8ea3b084a0171fa327d073d4bec51f Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Mon, 19 Mar 2018 17:04:43 -0700 Subject: [PATCH 16/19] fix piping --- .../Commands/AddAzureKeyVaultCertificate.cs | 1 - .../AddAzureKeyVaultCertificateContact.cs | 21 +-------- .../Commands/BackupAzureKeyVaultKey.cs | 1 + .../Commands/BackupAzureKeyVaultSecret.cs | 1 + .../SetAzureKeyVaultCertificateIssuer.cs | 47 ------------------- .../help/Add-AzureKeyVaultCertificate.md | 2 +- .../Add-AzureKeyVaultCertificateContact.md | 21 --------- .../help/Backup-AzureKeyVaultKey.md | 2 +- .../help/Backup-AzureKeyVaultSecret.md | 2 +- .../help/Remove-AzureRmKeyVault.md | 2 +- .../Set-AzureKeyVaultCertificateIssuer.md | 42 +++-------------- 11 files changed, 13 insertions(+), 129 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs index 196a646df76f..3d070f741ac3 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs @@ -59,7 +59,6 @@ public class AddAzureKeyVaultCertificate : KeyVaultCmdletBase Position = 2, HelpMessage = "Specifies the certificate policy.")] [ValidateNotNull] - [Alias("InputObject")] public PSKeyVaultCertificatePolicy CertificatePolicy { get; set; } /// diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs index bc48859621c1..4f1801cfc0c8 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificateContact.cs @@ -38,7 +38,6 @@ public class AddAzureKeyVaultCertificateContact : KeyVaultCmdletBase private const string InteractiveParameterSet = "Interactive"; private const string InputObjectParameterSet = "ByObject"; - private const string ResourceIdParameterSet = "ByResourceId"; #endregion @@ -47,8 +46,8 @@ public class AddAzureKeyVaultCertificateContact : KeyVaultCmdletBase /// [Parameter(Mandatory = true, ParameterSetName = InteractiveParameterSet, - Position = 0, ValueFromPipelineByPropertyName = true, + Position = 0, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } @@ -64,18 +63,6 @@ public class AddAzureKeyVaultCertificateContact : KeyVaultCmdletBase [ValidateNotNullOrEmpty] public PSKeyVault InputObject { get; set; } - /// - /// VaultId - /// - [Parameter(Mandatory = true, - ParameterSetName = ResourceIdParameterSet, - Position = 0, - ValueFromPipelineByPropertyName = true, - HelpMessage = "KeyVault Resource Id.")] - [ValidateNotNullOrEmpty] - [Alias("VaultId")] - public string ResourceId { get; set; } - /// /// EmailAddress /// @@ -99,12 +86,6 @@ public override void ExecuteCmdlet() VaultName = InputObject.VaultName.ToString(); } - if (ParameterSetName.Equals(ResourceIdParameterSet)) - { - var parsedResourceId = new ResourceIdentifier(ResourceId); - VaultName = parsedResourceId.ResourceName; - } - if (ShouldProcess(VaultName, Properties.Resources.AddCertificateContact)) { Contacts existingContacts; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs index b7cf07ab2787..32a8a7edff1f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultKey.cs @@ -76,6 +76,7 @@ public class BackupAzureKeyVaultKey : KeyVaultCmdletBase [Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, + ValueFromPipeline = true, ParameterSetName = ByKeyObjectParameterSet, HelpMessage = "Key bundle to back up, pipelined in from the output of a retrieval call.")] [ValidateNotNullOrEmpty] diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs index 3734cfefd874..eb8afcc1fdcb 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/BackupAzureKeyVaultSecret.cs @@ -76,6 +76,7 @@ public class BackupAzureKeyVaultSecret : KeyVaultCmdletBase [Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, + ValueFromPipeline = true, ParameterSetName = BySecretObjectParameterSet, HelpMessage = "Secret to be backed up, pipelined in from the output of a retrieval call.")] [ValidateNotNullOrEmpty] diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs index e8d8763102ef..da8280252c0e 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs @@ -36,9 +36,6 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase private const string ExpandedParameterSet = "Expanded"; private const string ByValueParameterSet = "ByValue"; - private const string InputObjectExpandedParameterSet = "InputObjectExpanded"; - private const string InputObjectByValueParameterSet = "InputObjectByValue"; - #endregion #region Input Parameter Definitions @@ -48,33 +45,11 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 0, - ParameterSetName = ExpandedParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] - [Parameter(Mandatory = true, - Position = 0, - ParameterSetName = ByValueParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Vault name. Cmdlet constructs the FQDN of a vault based on the name and currently selected environment.")] [ValidateNotNullOrEmpty] public string VaultName { get; set; } - /// - /// Vault object - /// - [Parameter(Mandatory = true, - Position = 0, - ParameterSetName = InputObjectExpandedParameterSet, - ValueFromPipeline = true, - HelpMessage = "Key Vault Object")] - [Parameter(Mandatory = true, - Position = 0, - ParameterSetName = InputObjectByValueParameterSet, - ValueFromPipeline = true, - HelpMessage = "Key Vault Object")] - [ValidateNotNullOrEmpty] - public PSKeyVault InputObject { get; set; } - /// /// Name /// @@ -93,9 +68,6 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase [Parameter(ParameterSetName = ExpandedParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the type of the issuer.")] - [Parameter(ParameterSetName = InputObjectExpandedParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the type of the issuer.")] [ValidateNotNullOrEmpty] public string IssuerProvider { get; set; } @@ -105,9 +77,6 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase [Parameter(ParameterSetName = ExpandedParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the account id to be used with the issuer.")] - [Parameter(ParameterSetName = InputObjectExpandedParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the account id to be used with the issuer.")] [ValidateNotNullOrEmpty] public string AccountId { get; set; } @@ -117,9 +86,6 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase [Parameter(ParameterSetName = ExpandedParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the api key to be used with the issuer.")] - [Parameter(ParameterSetName = InputObjectExpandedParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the api key to be used with the issuer.")] [ValidateNotNullOrEmpty] public SecureString ApiKey { get; set; } @@ -129,9 +95,6 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase [Parameter(ParameterSetName = ExpandedParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the organization details to be used with the issuer.")] - [Parameter(ParameterSetName = InputObjectExpandedParameterSet, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the organization details to be used with the issuer.")] [ValidateNotNullOrEmpty] public PSKeyVaultCertificateOrganizationDetails OrganizationDetails { get; set; } @@ -147,11 +110,6 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the certificate issuer to set.")] - [Parameter(Mandatory = true, - ParameterSetName = InputObjectByValueParameterSet, - ValueFromPipeline = true, - ValueFromPipelineByPropertyName = true, - HelpMessage = "Specifies the certificate issuer to set.")] [ValidateNotNullOrEmpty] public PSKeyVaultCertificateIssuerIdentityItem Issuer { get; set; } @@ -167,11 +125,6 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase public override void ExecuteCmdlet() { - if (InputObject != null) - { - VaultName = InputObject.VaultName; - } - if (ShouldProcess(Name, Properties.Resources.SetCertificateIssuer)) { PSKeyVaultCertificateIssuer issuerToUse; diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md index 9df1f44e5402..6b862577116f 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificate.md @@ -91,7 +91,7 @@ Specifies a **KeyVaultCertificatePolicy** object. ```yaml Type: PSKeyVaultCertificatePolicy Parameter Sets: (All) -Aliases: InputObject +Aliases: Required: False Position: 2 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md index 449aa4048f3e..389e44a73954 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Add-AzureKeyVaultCertificateContact.md @@ -25,12 +25,6 @@ Add-AzureKeyVaultCertificateContact [-InputObject] [-EmailAddress] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` -### ByResourceId -``` -Add-AzureKeyVaultCertificateContact [-ResourceId] [-EmailAddress] [-PassThru] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] -``` - ## DESCRIPTION The **Add-AzureKeyVaultCertificateContact** cmdlet adds a contact for a key vault for certificate notifications in Azure Key Vault. The contact receives updates about events such as certificate close to expiry, certificate renewed, and so on. @@ -108,21 +102,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -ResourceId -KeyVault Resource Id. - -```yaml -Type: String -Parameter Sets: ByResourceId -Aliases: VaultId - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByPropertyName) -Accept wildcard characters: False -``` - ### -VaultName Specifies the name of the key vault. diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md index b28d344ae1a3..f0f562aca37b 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultKey.md @@ -105,7 +105,7 @@ Aliases: Key Required: True Position: 0 Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md index 7e68fa4dc7df..b2f40d0340ce 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Backup-AzureKeyVaultSecret.md @@ -103,7 +103,7 @@ Aliases: Secret Required: True Position: 0 Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md index 78973b93009c..80157589ce15 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md @@ -1,4 +1,4 @@ ---- +--- external help file: Microsoft.Azure.Commands.KeyVault.dll-Help.xml Module Name: AzureRM.KeyVault ms.assetid: 7A929BA8-02D9-4BBE-AFF3-B8781F8DDAD9 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md index c7e565165de5..e68e923ca382 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md @@ -28,21 +28,6 @@ Set-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] [-WhatIf] [-Confirm] [] ``` -### InputObjectExpanded -``` -Set-AzureKeyVaultCertificateIssuer [-InputObject] [-Name] [-IssuerProvider ] - [-AccountId ] [-ApiKey ] - [-OrganizationDetails ] [-PassThru] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] -``` - -### InputObjectByValue -``` -Set-AzureKeyVaultCertificateIssuer [-InputObject] [-Name] - -Issuer [-PassThru] [-DefaultProfile ] - [-WhatIf] [-Confirm] [] -``` - ## DESCRIPTION The Set-AzureKeyVaultCertificateIssuer cmdlet sets a certificate issuer in a key vault. @@ -62,7 +47,7 @@ Specifies the account ID for the certificate issuer. ```yaml Type: String -Parameter Sets: Expanded, InputObjectExpanded +Parameter Sets: Expanded Aliases: Required: False @@ -77,7 +62,7 @@ Specifies the API key for the certificate issuer. ```yaml Type: SecureString -Parameter Sets: Expanded, InputObjectExpanded +Parameter Sets: Expanded Aliases: Required: False @@ -102,27 +87,12 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -InputObject -Key Vault Object - -```yaml -Type: PSKeyVault -Parameter Sets: InputObjectExpanded, InputObjectByValue -Aliases: - -Required: True -Position: 0 -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - ### -Issuer Specifies the certificate issuer to update. ```yaml Type: PSKeyVaultCertificateIssuerIdentityItem -Parameter Sets: ByValue, InputObjectByValue +Parameter Sets: ByValue Aliases: Required: True @@ -137,7 +107,7 @@ Specifies the type of certificate issuer. ```yaml Type: String -Parameter Sets: Expanded, InputObjectExpanded +Parameter Sets: Expanded Aliases: Required: False @@ -167,7 +137,7 @@ Organization details to be used with the issuer. ```yaml Type: PSKeyVaultCertificateOrganizationDetails -Parameter Sets: Expanded, InputObjectExpanded +Parameter Sets: Expanded Aliases: Required: False @@ -198,7 +168,7 @@ Specifies the name of the key vault. ```yaml Type: String -Parameter Sets: Expanded, ByValue +Parameter Sets: (All) Aliases: Required: True From a1a3b3bb9ccc6f6a8b4491baeeeb43e4b63b93cc Mon Sep 17 00:00:00 2001 From: Maddie Clayton Date: Mon, 19 Mar 2018 17:48:20 -0700 Subject: [PATCH 17/19] Update GetAzureKeyVaultCertificateIssuer.cs --- .../Commands/GetAzureKeyVaultCertificateIssuer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs index 99284a8b8c0e..ab1e2a696d4a 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/GetAzureKeyVaultCertificateIssuer.cs @@ -86,7 +86,10 @@ public override void ExecuteCmdlet() { var issuer = this.DataServiceClient.GetCertificateIssuer(VaultName, Name); var psissuer = PSKeyVaultCertificateIssuer.FromIssuer(issuer); - psissuer.VaultName = VaultName; + if (psissuer != null) + { + psissuer.VaultName = VaultName; + } this.WriteObject(psissuer); } } From d508cdf5bedc918339c87cf251ee326703cb06eb Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Wed, 21 Mar 2018 10:48:17 -0700 Subject: [PATCH 18/19] address comments --- .../Commands/ImportAzureKeyVaultCertificate.cs | 1 - .../Commands/NewAzureKeyVaultCertificatePolicy.cs | 9 +++++---- .../Commands/SetAzureKeyVaultCertificateIssuer.cs | 7 ++++--- .../Commands/SetAzureKeyVaultCertificatePolicy.cs | 11 ++++++----- .../help/Import-AzureKeyVaultCertificate.md | 2 +- .../help/New-AzureKeyVaultCertificatePolicy.md | 6 +++--- .../help/Set-AzureKeyVaultCertificateIssuer.md | 8 ++++---- .../help/Set-AzureKeyVaultCertificatePolicy.md | 12 ++++++------ 8 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs index 4034d7c211f7..5a38280b3d65 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ImportAzureKeyVaultCertificate.cs @@ -105,7 +105,6 @@ public class ImportAzureKeyVaultCertificate : KeyVaultCmdletBase ValueFromPipeline = true, ParameterSetName = ImportWithPrivateKeyFromCollectionParameterSet, HelpMessage = "Specifies the certificate collection to add to key vault.")] - [Alias("InputObject")] public X509Certificate2Collection CertificateCollection { get; set; } /// diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs index d3f2ebea5a53..474c1ebab9dc 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/NewAzureKeyVaultCertificatePolicy.cs @@ -71,7 +71,8 @@ public class NewAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase ParameterSetName = DNSNamesParameterSet, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the DNS names in the certificate.")] - public List DnsNames { get; set; } + [Alias("DnsNames")] + public List DnsName { get; set; } /// /// RenewAtNumberOfDaysBeforeExpiry @@ -196,7 +197,7 @@ public override void ExecuteCmdlet() var policy = new PSKeyVaultCertificatePolicy { - DnsNames = DnsNames, + DnsNames = DnsName, KeyUsage = KeyUsage, Ekus = Ekus, Enabled = !Disabled.IsPresent, @@ -263,9 +264,9 @@ private void ValidateEkus() private void ValidateDnsNames() { - if (DnsNames != null) + if (DnsName != null) { - foreach (var dnsName in DnsNames) + foreach (var dnsName in DnsName) { if (string.IsNullOrWhiteSpace(dnsName)) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs index da8280252c0e..1cc3a88e5104 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs @@ -111,7 +111,8 @@ public class SetAzureKeyVaultCertificateIssuer : KeyVaultCmdletBase ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the certificate issuer to set.")] [ValidateNotNullOrEmpty] - public PSKeyVaultCertificateIssuerIdentityItem Issuer { get; set; } + [Alias("Issuer")] + public PSKeyVaultCertificateIssuerIdentityItem InputObject { get; set; } #endregion @@ -129,9 +130,9 @@ public override void ExecuteCmdlet() { PSKeyVaultCertificateIssuer issuerToUse; - if (Issuer != null) + if (InputObject != null) { - issuerToUse = (PSKeyVaultCertificateIssuer) Issuer; + issuerToUse = (PSKeyVaultCertificateIssuer) InputObject; } else { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs index 46dd5aee6c60..977cf9927763 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs @@ -69,7 +69,7 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase /// [Parameter(Mandatory = true, Position = 2, - ValueFromPipelineByPropertyName = true, + ValueFromPipeline = true, ParameterSetName = ByValueParameterSet, HelpMessage = "Specifies the certificate policy.")] [ValidateNotNull] @@ -150,7 +150,8 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase [Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = ExpandedRenewNumberParameterSet, HelpMessage = "Specifies the subject name of the certificate.")] - public List DnsNames { get; set; } + [Alias("DnsNames")] + public List DnsName { get; set; } /// /// Key Usage @@ -266,7 +267,7 @@ public override void ExecuteCmdlet() policy = new PSKeyVaultCertificatePolicy { - DnsNames = DnsNames, + DnsNames = DnsName, KeyUsage = KeyUsage, Ekus = Ekus, Enabled = !Disabled.IsPresent, @@ -340,9 +341,9 @@ private void ValidateEkus() private void ValidateDnsNames() { - if (DnsNames != null) + if (DnsName != null) { - foreach (var dnsName in DnsNames) + foreach (var dnsName in DnsName) { if (string.IsNullOrWhiteSpace(dnsName)) { diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md index b7329b19004b..8be086c12133 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Import-AzureKeyVaultCertificate.md @@ -87,7 +87,7 @@ Specifies the certificate collection to add to a key vault. ```yaml Type: X509Certificate2Collection Parameter Sets: ImportWithPrivateKeyFromCollection -Aliases: InputObject +Aliases: Required: True Position: 2 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md index 8727fe20bd51..5f385df6e56d 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/New-AzureKeyVaultCertificatePolicy.md @@ -27,7 +27,7 @@ New-AzureKeyVaultCertificatePolicy [-IssuerName] [-SubjectName] [[-SubjectName] ] - [-DnsNames] [-RenewAtNumberOfDaysBeforeExpiry ] + [-DnsName] [-RenewAtNumberOfDaysBeforeExpiry ] [-RenewAtPercentageLifetime ] [-SecretContentType ] [-ReuseKeyOnRenewal] [-Disabled] [-KeyUsage ] [-Ekus ] [-ValidityInMonths ] @@ -95,13 +95,13 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -DnsNames +### -DnsName Specifies the DNS names in the certificate. ```yaml Type: System.Collections.Generic.List`1[System.String] Parameter Sets: DNSNames -Aliases: +Aliases: DnsNames Required: True Position: 1 diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md index e68e923ca382..209326668b74 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificateIssuer.md @@ -24,7 +24,7 @@ Set-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] [-Issu ### ByValue ``` Set-AzureKeyVaultCertificateIssuer [-VaultName] [-Name] - -Issuer [-PassThru] [-DefaultProfile ] + -InputObject [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -87,13 +87,13 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Issuer -Specifies the certificate issuer to update. +### -InputObject +Specifies the certificate issuer to set. ```yaml Type: PSKeyVaultCertificateIssuerIdentityItem Parameter Sets: ByValue -Aliases: +Aliases: Issuer Required: True Position: Named diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md index 33d043764021..08ce16655ce5 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md @@ -17,7 +17,7 @@ Creates or updates the policy for a certificate in a key vault. ``` Set-AzureKeyVaultCertificatePolicy [-VaultName] [-Name] [-RenewAtPercentageLifetime ] [-SecretContentType ] [-ReuseKeyOnRenewal ] [-Disabled] [-SubjectName ] - [-DnsNames ] + [-DnsName ] [-KeyUsage ] [-Ekus ] [-ValidityInMonths ] [-IssuerName ] [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] @@ -37,7 +37,7 @@ Set-AzureKeyVaultCertificatePolicy [-VaultName] [-Name] ``` Set-AzureKeyVaultCertificatePolicy [-VaultName] [-Name] -RenewAtNumberOfDaysBeforeExpiry [-SecretContentType ] [-ReuseKeyOnRenewal ] - [-Disabled] [-SubjectName ] [-DnsNames ] + [-Disabled] [-SubjectName ] [-DnsName ] [-KeyUsage ] [-Ekus ] [-ValidityInMonths ] [-IssuerName ] [-CertificateType ] [-EmailAtNumberOfDaysBeforeExpiry ] [-EmailAtPercentageLifetime ] @@ -104,13 +104,13 @@ Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` -### -DnsNames -Specifies the DNS names in the certificate. +### -DnsName +Specifies the subject name of the certificate. ```yaml Type: System.Collections.Generic.List`1[System.String] Parameter Sets: ExpandedRenewPercentage, ExpandedRenewNumber -Aliases: +Aliases: DnsNames Required: False Position: Named @@ -175,7 +175,7 @@ Aliases: CertificatePolicy Required: True Position: 2 Default value: None -Accept pipeline input: True (ByPropertyName) +Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` From aa6fa329aa994c0b3ccbc77edd2bfb7986d92b39 Mon Sep 17 00:00:00 2001 From: maddieclayton Date: Wed, 21 Mar 2018 12:31:54 -0700 Subject: [PATCH 19/19] update valuefrompipelinebyproperty --- .../Commands/SetAzureKeyVaultCertificatePolicy.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs index 977cf9927763..47ce048e10e2 100644 --- a/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs +++ b/src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificatePolicy.cs @@ -70,6 +70,7 @@ public class SetAzureKeyVaultCertificatePolicy : KeyVaultCmdletBase [Parameter(Mandatory = true, Position = 2, ValueFromPipeline = true, + ValueFromPipelineByPropertyName = true, ParameterSetName = ByValueParameterSet, HelpMessage = "Specifies the certificate policy.")] [ValidateNotNull]