Skip to content

Commit 8fbd6da

Browse files
author
Maddie Clayton
authored
Update SetAzureKeyVaultSecret.cs
1 parent 0ab63c1 commit 8fbd6da

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

src/KeyVault/KeyVault/Commands/SetAzureKeyVaultSecret.cs

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ----------------------------------------------------------------------------------
1+
// ----------------------------------------------------------------------------------
22
//
33
// Copyright Microsoft Corporation
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -125,28 +125,12 @@ public override void ExecuteCmdlet()
125125

126126
if (ShouldProcess(Name, Properties.Resources.SetSecret))
127127
{
128-
PSKeyVaultSecretAttributes attributes = new PSKeyVaultSecretAttributes();
129-
130-
attributes.Enabled = !Disable.IsPresent;
131-
132-
if (Expires != null) {
133-
attributes.Expires = this.Expires;
134-
}
135-
136-
if (this.NotBefore != null) {
137-
attributes.NotBefore = this.NotBefore;
138-
}
139-
140-
if (this.ContentType != null) {
141-
attributes.ContentType = this.ContentType;
142-
}
143-
144-
if (this.Tag != null)
145-
{
146-
attributes.Tags = TagsConversionHelper.CreateTagHashtable(TagsConversionHelper.CreateTagDictionary(this.Tag, true));
147-
}
148-
149-
var secret = DataServiceClient.SetSecret(VaultName, Name, SecretValue, attributes);
128+
var secret = DataServiceClient.SetSecret(
129+
VaultName,
130+
Name,
131+
SecretValue,
132+
new PSKeyVaultSecretAttributes(!Disable.IsPresent, Expires, NotBefore, ContentType,
133+
TagsConversionHelper.CreateTagHashtable(TagsConversionHelper.CreateTagDictionary(this.Tag, true))));
150134
WriteObject(secret);
151135
}
152136
}

0 commit comments

Comments
 (0)