/// <summary> /// Creates and returns <see cref="KeyVaultCredentialSettings"/> object. /// </summary> protected override void ProcessRecord() { string target = "Azure Key Vault"; string action = "Creation"; if (ShouldProcess(target, action)) { KeyVaultCredentialSettings settings = new KeyVaultCredentialSettings(); settings.ResourceGroupName = (this.ResourceGroupName == null) ? null : this.ResourceGroupName; settings.Enable = (this.Enable.IsPresent) ? this.Enable.ToBool() : false; settings.CredentialName = (this.CredentialName == null) ? null : this.CredentialName; settings.ServicePrincipalName = (this.ServicePrincipalName == null) ? null : this.ServicePrincipalName; settings.ServicePrincipalSecret = (this.ServicePrincipalSecret == null) ? null : ConversionUtilities.SecureStringToString(ServicePrincipalSecret); settings.AzureKeyVaultUrl = (this.AzureKeyVaultUrl == null) ? null : this.AzureKeyVaultUrl; WriteObject(settings); } }
/// <summary> /// Creates and returns <see cref="KeyVaultCredentialSettings"/> object. /// </summary> protected override void ProcessRecord() { string target = "Azure Key Vault"; string action = "Creation"; if (ShouldProcess(target, action)) { KeyVaultCredentialSettings settings = new KeyVaultCredentialSettings(); settings.ResourceGroupName = (this.ResourceGroupName == null) ? null : this.ResourceGroupName; settings.Enable = (this.Enable.IsPresent) ? this.Enable.ToBool() : false; settings.CredentialName = (this.CredentialName == null) ? null : this.CredentialName; settings.ServicePrincipalName = (this.ServicePrincipalName == null) ? null : this.ServicePrincipalName; settings.ServicePrincipalSecret = (this.ServicePrincipalSecret == null) ? null : ConvertToUnsecureString(ServicePrincipalSecret); settings.AzureKeyVaultUrl = (this.AzureKeyVaultUrl == null) ? null : this.AzureKeyVaultUrl; WriteObject(settings); } }