Skip to content

Commit ee94528

Browse files
grizzlytheodoregithub-actions
andauthored
Update-AzDiskEncryptionSet bug fix (#25139)
* Autogen code * changes * fix code * changelog and md file --------- Co-authored-by: github-actions <[email protected]>
1 parent 27357f9 commit ee94528

File tree

5 files changed

+53
-11
lines changed

5 files changed

+53
-11
lines changed

src/Compute/Compute/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
-->
2222
## Upcoming Release
23+
* Added parameter `-IdentityType` to cmdlet `Update-AzDiskEncryptionSet`.
2324

2425
## Version 8.0.0
2526
* Added new optional parameter `SecureVMGuestStateSAS` to cmdlet `Grant-AzDiskAccess`.

src/Compute/Compute/Generated/DiskEncryptionSet/Config/NewAzureRmDiskEncryptionSetConfigCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ public partial class NewAzureRmDiskEncryptionSetConfigCommand : Microsoft.Azure.
5151
[Parameter(
5252
Mandatory = false,
5353
Position = 2,
54-
ValueFromPipelineByPropertyName = true)]
55-
[PSArgumentCompleter("SystemAssigned")]
54+
ValueFromPipelineByPropertyName = true,
55+
HelpMessage = "The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys.")]
56+
[PSArgumentCompleter("SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned")]
5657
public string IdentityType { get; set; }
5758

5859
[Parameter(

src/Compute/Compute/Generated/DiskEncryptionSet/DiskEncryptionSetUpdateMethod.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ public override void ExecuteCmdlet()
153153
HelpMessage = "The list of user identities associated with the disk encryption set. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.")]
154154
public Hashtable UserAssignedIdentity { get; set; }
155155

156+
[Parameter(
157+
Mandatory = false,
158+
ValueFromPipelineByPropertyName = true,
159+
HelpMessage = "The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys.")]
160+
[PSArgumentCompleter("SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned")]
161+
public string IdentityType { get; set; }
162+
156163
private DiskEncryptionSetUpdate DiskEncryptionSetUpdate { get; set; }
157164

158165
private void BuildPatchObject()
@@ -166,7 +173,6 @@ private void BuildPatchObject()
166173
{
167174
if (this.DiskEncryptionSetUpdate.ActiveKey == null)
168175
{
169-
//this.DiskEncryptionSetUpdate.ActiveKey = new KeyVaultAndKeyReference();
170176
this.DiskEncryptionSetUpdate.ActiveKey = new KeyForDiskEncryptionSet();
171177
}
172178
this.DiskEncryptionSetUpdate.ActiveKey.KeyUrl = this.KeyUrl;
@@ -176,7 +182,6 @@ private void BuildPatchObject()
176182
{
177183
if (this.DiskEncryptionSetUpdate.ActiveKey == null)
178184
{
179-
//this.DiskEncryptionSetUpdate.ActiveKey = new KeyVaultAndKeyReference();
180185
this.DiskEncryptionSetUpdate.ActiveKey = new KeyForDiskEncryptionSet();
181186
}
182187
if (this.DiskEncryptionSetUpdate.ActiveKey.SourceVault == null)
@@ -226,6 +231,15 @@ private void BuildPatchObject()
226231
}
227232
}
228233
}
234+
235+
if (this.IsParameterBound(c => c.IdentityType))
236+
{
237+
if (this.DiskEncryptionSetUpdate.Identity == null)
238+
{
239+
this.DiskEncryptionSetUpdate.Identity = new EncryptionSetIdentity();
240+
}
241+
this.DiskEncryptionSetUpdate.Identity.Type = this.IdentityType;
242+
}
229243
}
230244

231245
private void BuildPutObject()
@@ -292,6 +306,16 @@ private void BuildPutObject()
292306
}
293307
}
294308
}
309+
310+
if (this.IsParameterBound(c => c.IdentityType))
311+
{
312+
if (this.InputObject.Identity == null)
313+
{
314+
this.InputObject.Identity = new EncryptionSetIdentity();
315+
}
316+
this.InputObject.Identity.Type = this.IdentityType;
317+
}
295318
}
296319
}
297320
}
321+

src/Compute/Compute/Generated/Models/PSDiskEncryptionSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ public string ResourceGroupName
5454
public string FederatedClientId { get; set; }
5555

5656
}
57-
}
57+
}

src/Compute/Compute/help/Update-AzDiskEncryptionSet.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,25 @@ Updates a disk encryption set.
1616
```
1717
Update-AzDiskEncryptionSet [-ResourceGroupName] <String> [-Name] <String> [-KeyUrl <String>]
1818
[-SourceVaultId <String>] [-RotationToLatestKeyVersionEnabled <Boolean>] [[-Tag] <Hashtable>] [-AsJob]
19-
[-FederatedClientId <String>] [-UserAssignedIdentity <Hashtable>] [-DefaultProfile <IAzureContextContainer>]
20-
[-WhatIf] [-Confirm] [<CommonParameters>]
19+
[-FederatedClientId <String>] [-UserAssignedIdentity <Hashtable>] [-IdentityType <String>]
20+
[-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
21+
[<CommonParameters>]
2122
```
2223

2324
### ResourceIdParameter
2425
```
2526
Update-AzDiskEncryptionSet [-ResourceId] <String> [-KeyUrl <String>] [-SourceVaultId <String>]
2627
[-RotationToLatestKeyVersionEnabled <Boolean>] [[-Tag] <Hashtable>] [-AsJob] [-FederatedClientId <String>]
27-
[-UserAssignedIdentity <Hashtable>] [-DefaultProfile <IAzureContextContainer>]
28-
[-WhatIf] [-Confirm] [<CommonParameters>]
28+
[-UserAssignedIdentity <Hashtable>] [-IdentityType <String>] [-DefaultProfile <IAzureContextContainer>]
29+
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
2930
```
3031

3132
### ObjectParameter
3233
```
3334
Update-AzDiskEncryptionSet [-InputObject] <PSDiskEncryptionSet> [-KeyUrl <String>] [-SourceVaultId <String>]
3435
[-RotationToLatestKeyVersionEnabled <Boolean>] [[-Tag] <Hashtable>] [-AsJob] [-FederatedClientId <String>]
35-
[-UserAssignedIdentity <Hashtable>] [-DefaultProfile <IAzureContextContainer>]
36-
[-WhatIf] [-Confirm] [<CommonParameters>]
36+
[-UserAssignedIdentity <Hashtable>] [-IdentityType <String>] [-DefaultProfile <IAzureContextContainer>]
37+
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
3738
```
3839

3940
## DESCRIPTION
@@ -95,6 +96,21 @@ Accept pipeline input: True (ByPropertyName)
9596
Accept wildcard characters: False
9697
```
9798
99+
### -IdentityType
100+
The type of Managed Identity used by the DiskEncryptionSet. Only SystemAssigned is supported for new creations. Disk Encryption Sets can be updated with Identity type None during migration of subscription to a new Azure Active Directory tenant; it will cause the encrypted resources to lose access to the keys.
101+
102+
```yaml
103+
Type: System.String
104+
Parameter Sets: (All)
105+
Aliases:
106+
107+
Required: False
108+
Position: Named
109+
Default value: None
110+
Accept pipeline input: True (ByPropertyName)
111+
Accept wildcard characters: False
112+
```
113+
98114
### -InputObject
99115
The local object of the disk encryption set.
100116

0 commit comments

Comments
 (0)