Skip to content

Commit 37c0241

Browse files
authored
Merge pull request #5798 from maddieclayton/KeyVaultdep
Add deprecation messages and fixes for KeyVault
2 parents 815af56 + f36345f commit 37c0241

14 files changed

+112
-19
lines changed

src/ResourceManager/KeyVault/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020
## Current Release
2121
* Updated cmdlets to include piping scenarios
22+
* Add deprecation messages for upcoming breaking change release
2223
* Updated to the latest version of the Azure ClientRuntime
2324

2425
## Version 4.2.1

src/ResourceManager/KeyVault/Commands.KeyVault/Commands/AddAzureKeyVaultCertificate.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public class AddAzureKeyVaultCertificate : KeyVaultCmdletBase
7373

7474
public override void ExecuteCmdlet()
7575
{
76+
WriteWarning("Add-AzureKeyVaultCertificate: The -CertificatePolicy parameter will become mandatory in the May 2018 release.");
7677
if (ShouldProcess(Name, Properties.Resources.AddCertificate)) {
7778
var certificateOperation = this.DataServiceClient.EnrollCertificate(VaultName, Name, CertificatePolicy == null ? null : CertificatePolicy.ToCertificatePolicy(), Tag == null ? null : Tag.ConvertToDictionary());
7879
var kvCertificateOperation = PSKeyVaultCertificateOperation.FromCertificateOperation(certificateOperation);

src/ResourceManager/KeyVault/Commands.KeyVault/Commands/ManagedStorageAccounts/SetAzureKeyVaultManagedStorageSasDefinition.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public partial class SetAzureKeyVaultManagedStorageSasDefinition : KeyVaultCmdle
6262
ValueFromPipelineByPropertyName = true,
6363
HelpMessage = "Sas definition parameters that will be used to create the sas token.",
6464
ParameterSetName = ParameterSetRawSas )]
65+
[Obsolete("-Parameter will be removed and replaced by -TemplateUri and -SasType in May 2018")]
6566
[ValidateNotNull]
6667
public Hashtable Parameter { get; set; }
6768

@@ -277,7 +278,9 @@ private IDictionary<string, string> GetParameters()
277278
case ParameterSetRawSas:
278279
{
279280
var dictionary = new Dictionary<string, string>();
281+
#pragma warning disable CS0618
280282
foreach ( DictionaryEntry p in Parameter )
283+
#pragma warning restore CS0618
281284
{
282285
if ( p.Key == null || string.IsNullOrEmpty( p.Key.ToString() ) )
283286
throw new ArgumentException( "An invalid parameter was specified." );

src/ResourceManager/KeyVault/Commands.KeyVault/Commands/RemoveAzureKeyVault.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,11 @@ public class RemoveAzureKeyVault : KeyVaultManagementCmdletBase
9090
ParameterSetName = RemoveVaultParameterSet,
9191
ValueFromPipelineByPropertyName = true,
9292
HelpMessage = "The location of the deleted vault.")]
93-
[Parameter(Mandatory = false,
94-
Position = 1,
95-
ParameterSetName = InputObjectRemoveVaultParameterSet,
96-
ValueFromPipelineByPropertyName = true,
97-
HelpMessage = "The location of the deleted vault.")]
9893
[Parameter(Mandatory = true,
9994
Position = 1,
10095
ParameterSetName = RemoveDeletedVaultParameterSet,
10196
ValueFromPipelineByPropertyName = true,
10297
HelpMessage = "The location of the deleted vault.")]
103-
[Parameter(Mandatory = true,
104-
Position = 1,
105-
ParameterSetName = InputObjectRemoveDeletedVaultParameterSet,
106-
ValueFromPipelineByPropertyName = true,
107-
HelpMessage = "The location of the deleted vault.")]
10898
[LocationCompleter("Microsoft.KeyVault/vaults")]
10999
[ValidateNotNullOrEmpty()]
110100
public string Location { get; set; }
@@ -142,6 +132,7 @@ public override void ExecuteCmdlet()
142132
{
143133
VaultName = InputObject.VaultName;
144134
ResourceGroupName = InputObject.ResourceGroupName;
135+
Location = InputObject.Location;
145136
}
146137

147138
if (InRemovedState)

src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultCertificateIssuer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public override void ExecuteCmdlet()
136136
}
137137
else
138138
{
139+
WriteWarning("Set-AzureKeyVaultCertificateIssuer: The -IssuerProvider parameter will become mandatory in the May 2018 release.");
139140
issuerToUse = new PSKeyVaultCertificateIssuer
140141
{
141142
Name = Name,

src/ResourceManager/KeyVault/Commands.KeyVault/Commands/SetAzureKeyVaultSecretAttribute.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ public override void ExecuteCmdlet()
142142
Name,
143143
Version ?? string.Empty,
144144
new PSKeyVaultSecretAttributes(Enable, Expires, NotBefore, ContentType, Tag));
145-
146145
if (PassThru)
147146
{
148147
WriteObject(secret);

src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultCertificateRemoval.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public override void ExecuteCmdlet()
8080

8181
if ( ShouldProcess( Name, Properties.Resources.RecoverCertificate ) )
8282
{
83+
WriteWarning("Undo-AzureKeyVaultCertificateRemoval: The output of the cmdlet will be changing from CertificateBundle to PSKeyVaultCertificate in May 2018");
8384
CertificateBundle certificate = DataServiceClient.RecoverCertificate(VaultName, Name);
8485

8586
WriteObject( certificate );

src/ResourceManager/KeyVault/Commands.KeyVault/Commands/UndoAzureKeyVaultRemoval.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public override void ExecuteCmdlet()
9191
{
9292
if (InputObject != null)
9393
{
94+
WriteWarning("Undo-AzureRmKeyVaultRemoval: ResourceGroupName will be removed from the InputObject parameter set in May 2018, and will instead be obtained from the ResourceId.");
9495
VaultName = InputObject.VaultName;
9596
Location = InputObject.Location;
9697
}

src/ResourceManager/KeyVault/Commands.KeyVault/Models/ModelExtensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ public static string GetDisplayNameForADObject(string objectId, ActiveDirectoryC
117117
displayName = servicePrincipal.DisplayName;
118118
upnOrSpn = servicePrincipal.ServicePrincipalNames.FirstOrDefault();
119119
}
120+
else if (obj.Type.Equals("group", StringComparison.InvariantCultureIgnoreCase))
121+
{
122+
var group = adClient.FilterGroups(new ADObjectFilterOptions { Id = objectId }).FirstOrDefault();
123+
displayName = group.DisplayName;
124+
}
120125
}
121126
#else
122127
var obj = adClient.GetObjectsByObjectIdsAsync(new[] { objectId }, new string[] { }).GetAwaiter().GetResult().FirstOrDefault();
@@ -134,6 +139,12 @@ public static string GetDisplayNameForADObject(string objectId, ActiveDirectoryC
134139
displayName = servicePrincipal.AppDisplayName;
135140
upnOrSpn = servicePrincipal.ServicePrincipalNames.FirstOrDefault();
136141
}
142+
else if (obj.ObjectType.Equals("group", StringComparison.InvariantCultureIgnoreCase))
143+
{
144+
var group = adClient.Groups.GetByObjectId(objectId).ExecuteAsync().GetAwaiter().GetResult();
145+
displayName = group.DisplayName;
146+
upnOrSpn = group.MailNickname;
147+
}
137148
}
138149

139150
#endif

src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/KeyVault/Commands.KeyVault/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ You can find the object ID using Azure Active Directory Module for Windows Power
391391
<value>Purge secret</value>
392392
</data>
393393
<data name="AllPermissionExpansionWarning" xml:space="preserve">
394-
<value>The 'all' permission is being deprecated and does not include the 'purge' permission. 'Purge' permission must be explicitly set.</value>
394+
<value>The 'all' permission will be removed in May 2018 and does not include the 'purge' permission. 'Purge' permission must be explicitly set.</value>
395395
</data>
396396
<data name="RecoverVault" xml:space="preserve">
397397
<value>Recover vault</value>

src/ResourceManager/KeyVault/Commands.KeyVault/help/Remove-AzureRmKeyVault.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ Remove-AzureRmKeyVault [-VaultName] <String> [-Location] <String> [-InRemovedSta
2727

2828
### InputObjectByAvailableVault
2929
```
30-
Remove-AzureRmKeyVault [-InputObject] <PSKeyVault> [[-Location] <String>] [-Force] [-AsJob] [-PassThru]
30+
Remove-AzureRmKeyVault [-InputObject] <PSKeyVault> [-Force] [-AsJob] [-PassThru]
3131
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3232
```
3333

3434
### InputObjectByDeletedVault
3535
```
36-
Remove-AzureRmKeyVault [-InputObject] <PSKeyVault> [-Location] <String> [-InRemovedState] [-Force] [-AsJob]
37-
[-PassThru] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
36+
Remove-AzureRmKeyVault [-InputObject] <PSKeyVault> [-InRemovedState] [-Force] [-AsJob] [-PassThru]
37+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3838
```
3939

4040
## DESCRIPTION
@@ -143,7 +143,7 @@ The location of the deleted vault.
143143
144144
```yaml
145145
Type: String
146-
Parameter Sets: ByAvailableVault, InputObjectByAvailableVault
146+
Parameter Sets: ByAvailableVault
147147
Aliases:
148148

149149
Required: False
@@ -155,7 +155,7 @@ Accept wildcard characters: False
155155
156156
```yaml
157157
Type: String
158-
Parameter Sets: ByDeletedVault, InputObjectByDeletedVault
158+
Parameter Sets: ByDeletedVault
159159
Aliases:
160160

161161
Required: True

src/ResourceManager/KeyVault/Commands.KeyVault/help/Set-AzureKeyVaultCertificatePolicy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Aliases: CertificatePolicy
175175
Required: True
176176
Position: 2
177177
Default value: None
178-
Accept pipeline input: True (ByValue)
178+
Accept pipeline input: True (ByPropertyName, ByValue)
179179
Accept wildcard characters: False
180180
```
181181

src/ResourceManager/KeyVault/documentation/upcoming-breaking-changes.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,90 @@
2727

2828
# Upcoming Breaking Changes
2929

30+
The following cmdlets were affected this release:
31+
32+
**Add-AzureKeyVaultCertificate**
33+
- The -Certificate parameter has become mandatory.
34+
35+
**Set-AzureKeyVaultManagedStorageSasDefinition**
36+
- The -Parameter parameter has been removed and replaced by -TemplateUri and -SasType
37+
38+
**Set-AzureKeyVaultCertificateIssuer**
39+
- The -IssuerProvider parameter has become mandatory.
40+
41+
**Undo-AzureKeyVaultCertificateRemoval**
42+
- The output of this cmdlet has changed from CertificateBundle to PSKeyVaultCertificate.
43+
44+
**Undo-AzureRmKeyVaultRemoval**
45+
- ResourceGroupName has been removed from the InputObject parameter set, and is instead obtained from the InputObject parameter's ResourceId property.
46+
47+
**Set-AzureRmKeyVaultAccessPolicy**
48+
- The "all" permission was removed from "PermissionsToKeys", "PermissionsToSecrets", and "PermissionsToCertificates".
49+
50+
**General**
51+
- ValueFromPipelineByPropertyName was removed from all cmdlets where piping by InputObject was enabled. These cmdlets are:
52+
- Add-AzureKeyVaultCertificate
53+
- Add-AzureKeyVaultCertificateContact
54+
- Add-AzureKeyVaultKey
55+
- Backup-AzureKeyVaultKey
56+
- Backup-AzureKeyVaultSecret
57+
- Get-AzureKeyVaultCertficate
58+
- Get-AzureKeyVaultCertificateContact
59+
- Get-AzureKeyVaultCertificateIssuer
60+
- Get-AzureKeyVaultCertificateOperation
61+
- Get-AzureKeyVaultCertificatePolicy
62+
- Get-AzureKeyVaultKey
63+
- Get-AzureKeyVaultSecret
64+
- Remove-AzureRmKeyVault
65+
- Remove-AzureRmKeyVaultAccessPolicy
66+
- Remove-AzureKeyVaultCertificate
67+
- Remove-AzureKeyVaultCertificateContact
68+
- Remove-AzureKeyVaultCertificateIssuer
69+
- Remove-AzureKeyVaultCertificateOperation
70+
- Remove-AzureKeyVaultKey
71+
- Remove-AzureKeyVaultSecret
72+
- Restore-AzureKeyVaultKey
73+
- Restore-AzureKeyVaultSecret
74+
- Set-AzureRmKeyVaultAccessPolicy
75+
- Set-AzureKeyVaultCertificateAttribute
76+
- Set-AzureKeyVaultCertificateIssuer
77+
- Set-AzureKeyVaultCertificatePolicy
78+
- Set-AzureKeyVaultKeyAttribute
79+
- Set-AzureKeyVaultSecret
80+
- Set-AzureKeyVaultSecretAttribute
81+
- Stop-AzureKeyVaultCertificateOperation
82+
- Undo-AzureKeyVaultCertificateRemoval
83+
- Undo-AzureKeyVaultKeyRemoval
84+
- Undo-AzureRmKeyVaultRemoval
85+
- Undo-AzureKeyVaultSecretRemoval
86+
- ConfirmImpact levels were removed from all cmdlets. Those affected are:
87+
- Remove-AzureRmKeyVault
88+
- Remove-AzureKeyVaultCertificate
89+
- Remove-AzureKeyVaultCertificateIssuer
90+
- Remove-AzureKeyVaultCertificateOperation
91+
- Remove-AzureKeyVaultKey
92+
- Remove-AzureKeyVaultSecret
93+
- Stop-AzureKeyVaultCertificateOperation
94+
- The IKeyVaultDataServiceClient was updated so all Certificate operations return PSTypes instead of SDK types. This includes:
95+
- SetCertificateContacts
96+
- GetCertificateContacts
97+
- GetCertificate
98+
- GetDeletedCertificate
99+
- MergeCertificate
100+
- ImportCertificate
101+
- DeleteCertificate
102+
- RecoverCertificate
103+
- EnrollCertificate
104+
- UpdateCertificate
105+
- GetCertificateOperation
106+
- DeleteCertificateOperation
107+
- CancelCertificateOperation
108+
- GetCertificatePolicy
109+
- UpdateCertificatePolicy
110+
- GetCertificateIssuer
111+
- SetCertificateIssuer
112+
- DeleteCertificateIssuer
113+
30114
## Release 3.0.0
31115

32116
The following cmdlets were affected this release:

0 commit comments

Comments
 (0)