Skip to content

Commit feae308

Browse files
authored
Replaced parameter EnableRbacAuthorization by DisableRbacAuthorization in New-AzKeyVault and Update-AzKeyVault (#24675)
* wip * RBAC will be enabled by default during the process of key vault creation. * add BreakingChangeIssues.csv * update help docs and test cases * remove unrelated files * refresh examples
1 parent f33f4c2 commit feae308

File tree

11 files changed

+55
-47
lines changed

11 files changed

+55
-47
lines changed

src/KeyVault/KeyVault.Test/LiveTests/TestLiveScenarios.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Invoke-LiveTestScenario -Name "Update key vault" -Description "Test updating pro
4747
# Update EnableRbacAuthorization
4848
$vault = New-AzKeyVault -VaultName $vaultName -ResourceGroupName $rgName -Location $vaultLocation
4949

50-
$vault = $vault | Update-AzKeyVault -EnableRbacAuthorization $false
50+
$vault = $vault | Update-AzKeyVault -DisableRbacAuthorization $true
5151
Assert-False { $vault.EnableRbacAuthorization } "EnableRbacAuthorization should be false"
5252

5353
# Update Tags

src/KeyVault/KeyVault.Test/ScenarioTests/KeyVaultManagementTests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function Test-CreateNewVault {
134134
Assert-AreEqual 10 $actual.SoftDeleteRetentionInDays "SoftDeleteRetentionInDays should be the same value as set"
135135

136136
# Test enable RbacAuthorization
137-
$actual = New-AzKeyVault -VaultName (getAssetName) -ResourceGroupName $rgName -Location $vaultLocation -EnableRbacAuthorization
137+
$actual = New-AzKeyVault -VaultName (getAssetName) -ResourceGroupName $rgName -Location $vaultLocation
138138
Assert-True { $actual.EnableRbacAuthorization } "If specified, EnableRbacAuthorization should be true"
139139

140140
# Test positional parameters
@@ -823,11 +823,11 @@ function Test-UpdateKeyVault {
823823
# Assert-Throws { $vault = $vault | Update-AzKeyVault -SoftDeleteRetentionInDays 80}
824824

825825
#Set EnableRbacAuthorization true
826-
$vault = $vault | Update-AzKeyVault -EnableRbacAuthorization $true
826+
$vault = $vault | Update-AzKeyVault -DisableRbacAuthorization $false
827827
Assert-True { $vault.EnableRbacAuthorization } "5. EnableRbacAuthorization should be true"
828828

829829
#Set EnableRbacAuthorization false
830-
$vault = $vault | Update-AzKeyVault -EnableRbacAuthorization $false
830+
$vault = $vault | Update-AzKeyVault -DisableRbacAuthorization $true
831831
Assert-False { $vault.EnableRbacAuthorization } "6. EnableRbacAuthorization should be false"
832832

833833
# Update Tags

src/KeyVault/KeyVault/ChangeLog.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* [Breaking Change] Replaced parameter `EnableRbacAuthorization` by `DisableRbacAuthorization` in `New-AzKeyVault` and `Update-AzKeyVault`.
22+
- RBAC will be enabled by default during the process of key vault creation.
2123
* Introduced secrets detection feature to safeguard sensitive data.
2224
* [Upcoming Breaking Change] Added breaking change warning message for parameter `UseDefaultCVMPolicy` of `Add-AzKeyVaultKey`.
2325
- The offline fallback policy will be removed. Key creation will fail if unable to get regional default CVM SKR policy from MAA Service Discovery API.
@@ -30,7 +32,7 @@
3032
* [Upcoming Breaking Change] Added breaking change warning message for parameter `EnableRbacAuthorization` of `New-AzKeyVault` and `Update-AzKeyVault`.
3133
- RBAC will be enabled by default during the process of key vault creation. To disable RBAC authorization, please use parameter 'DisableRbacAuthorization'.
3234
- Parameter `EnableRbacAuthorization` is expected to be removed in Az.KeyVault 6.0.0 and Az 12.0.0.
33-
- Parameter `EnableRbacAuthorization` is expected to be replaced by `DisableRbacAuthorization`.
35+
- Parameter `EnableRbacAuthorization` is expected to be replaced by `DisableRbacAuthorization`.
3436
* Upgraded Azure.Core to 1.37.0.
3537

3638
## Version 5.2.1

src/KeyVault/KeyVault/Commands/NewAzureKeyVault.cs renamed to src/KeyVault/KeyVault/Commands/KeyVault/NewAzureKeyVault.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ public class NewAzureKeyVault : KeyVaultManagementCmdletBase
8888
HelpMessage = "If specified, protection against immediate deletion is enabled for this vault; requires soft delete to be enabled as well. Enabling 'purge protection' on a key vault is an irreversible action. Once enabled, it cannot be changed or removed.")]
8989
public SwitchParameter EnablePurgeProtection { get; set; }
9090

91-
[CmdletParameterBreakingChangeWithVersion(nameof(EnableRbacAuthorization), "12.0.0", "6.0.0", ReplaceMentCmdletParameterName = "DisableRbacAuthorization", ChangeDescription = "RBAC will be enabled by default during the process of key vault creation. To disable RBAC authorization, please use parameter 'DisableRbacAuthorization'.")]
9291
[Parameter(Mandatory = false,
93-
HelpMessage = "If specified, enables to authorize data actions by Role Based Access Control (RBAC), and then the access policies specified in vault properties will be ignored. Note that management actions are always authorized with RBAC.")]
94-
public SwitchParameter EnableRbacAuthorization { get; set; }
92+
HelpMessage = "If specified, disables to authorize data actions by Role Based Access Control (RBAC), and then the access policies specified in vault properties will be ignored. Note that management actions are always authorized with RBAC.")]
93+
public SwitchParameter DisableRbacAuthorization { get; set; }
9594

9695
[Parameter(Mandatory = false, HelpMessage = "Specifies how long deleted resources are retained, and how long until a vault or an object in the deleted state can be purged. The default is " + Constants.DefaultSoftDeleteRetentionDaysString + " days.")]
9796
[ValidateRange(Constants.MinSoftDeleteRetentionDays, Constants.MaxSoftDeleteRetentionDays)]
@@ -169,7 +168,7 @@ public override void ExecuteCmdlet()
169168
EnabledForDiskEncryption = EnabledForDiskEncryption.IsPresent ? true : null as bool?,
170169
EnableSoftDelete = null,
171170
EnablePurgeProtection = EnablePurgeProtection.IsPresent ? true : (bool?)null, // false is not accepted
172-
EnableRbacAuthorization = EnableRbacAuthorization.IsPresent ? true : null as bool?,
171+
EnableRbacAuthorization = DisableRbacAuthorization.IsPresent ? false : true,
173172
/*
174173
* If retention days is not specified, use the default value,
175174
* else use the vault user provides

src/KeyVault/KeyVault/Commands/UpdateAzureKeyVault.cs renamed to src/KeyVault/KeyVault/Commands/KeyVault/UpdateAzureKeyVault.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ public class UpdateTopLevelResourceCommand : KeyVaultManagementCmdletBase
5252
[Parameter(Mandatory = false, HelpMessage = "Enable the purge protection functionality for this key vault. Once enabled it cannot be disabled. It requires soft-delete to be turned on.")]
5353
public SwitchParameter EnablePurgeProtection { get; set; }
5454

55-
[CmdletParameterBreakingChangeWithVersion(nameof(EnableRbacAuthorization), "12.0.0", "6.0.0", ReplaceMentCmdletParameterName = "DisableRbacAuthorization", ChangeDescription = "RBAC will be enabled by default during the process of key vault creation. To disable RBAC authorization, please use parameter 'DisableRbacAuthorization'.")]
56-
[Parameter(Mandatory = false, HelpMessage = "Enable or disable this key vault to authorize data actions by Role Based Access Control (RBAC).")]
57-
public bool? EnableRbacAuthorization { get; set; }
55+
[Parameter(Mandatory = false, HelpMessage = "Disable or enable this key vault to authorize data actions by Role Based Access Control (RBAC).")]
56+
public bool? DisableRbacAuthorization { get; set; }
5857

5958
[Parameter(Mandatory = false,
6059
HelpMessage = "Specifies whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except private endpoint traffic and that originates from trusted services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules.")]
@@ -105,7 +104,7 @@ public override void ExecuteCmdlet()
105104
updatedParamater: new VaultCreationOrUpdateParameters
106105
{
107106
EnablePurgeProtection = this.EnablePurgeProtection.IsPresent ? (true as bool?) : null,
108-
EnableRbacAuthorization = this.EnableRbacAuthorization,
107+
EnableRbacAuthorization = this.DisableRbacAuthorization == null ? null : !this.DisableRbacAuthorization,
109108
PublicNetworkAccess = this.PublicNetworkAccess,
110109
Tags = this.Tag
111110
}

src/KeyVault/KeyVault/help/New-AzKeyVault.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Creates a key vault.
1616
```
1717
New-AzKeyVault [-Name] <String> [-ResourceGroupName] <String> [-Location] <String> [-EnabledForDeployment]
1818
[-EnabledForTemplateDeployment] [-EnabledForDiskEncryption] [-EnablePurgeProtection]
19-
[-EnableRbacAuthorization] [-SoftDeleteRetentionInDays <Int32>] [-PublicNetworkAccess <String>]
19+
[-DisableRbacAuthorization] [-SoftDeleteRetentionInDays <Int32>] [-PublicNetworkAccess <String>]
2020
[-Sku <String>] [-Tag <Hashtable>] [-NetworkRuleSet <PSKeyVaultNetworkRuleSet>]
21-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
22-
[-SubscriptionId <String>] [<CommonParameters>]
21+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [-SubscriptionId <String>]
22+
[<CommonParameters>]
2323
```
2424

2525
## DESCRIPTION
@@ -184,9 +184,8 @@ Accept pipeline input: False
184184
Accept wildcard characters: False
185185
```
186186
187-
### -EnabledForDeployment
188-
Enables the Microsoft.Compute resource provider to retrieve secrets from this key vault when this
189-
key vault is referenced in resource creation, for example when creating a virtual machine.
187+
### -DisableRbacAuthorization
188+
If specified, disables to authorize data actions by Role Based Access Control (RBAC), and then the access policies specified in vault properties will be ignored. Note that management actions are always authorized with RBAC.
190189
191190
```yaml
192191
Type: System.Management.Automation.SwitchParameter
@@ -196,12 +195,13 @@ Aliases:
196195
Required: False
197196
Position: Named
198197
Default value: None
199-
Accept pipeline input: True (ByPropertyName)
198+
Accept pipeline input: False
200199
Accept wildcard characters: False
201200
```
202201
203-
### -EnabledForDiskEncryption
204-
Enables the Azure disk encryption service to get secrets and unwrap keys from this key vault.
202+
### -EnabledForDeployment
203+
Enables the Microsoft.Compute resource provider to retrieve secrets from this key vault when this
204+
key vault is referenced in resource creation, for example when creating a virtual machine.
205205
206206
```yaml
207207
Type: System.Management.Automation.SwitchParameter
@@ -215,8 +215,8 @@ Accept pipeline input: True (ByPropertyName)
215215
Accept wildcard characters: False
216216
```
217217
218-
### -EnabledForTemplateDeployment
219-
Enables Azure Resource Manager to get secrets from this key vault when this key vault is referenced in a template deployment.
218+
### -EnabledForDiskEncryption
219+
Enables the Azure disk encryption service to get secrets and unwrap keys from this key vault.
220220
221221
```yaml
222222
Type: System.Management.Automation.SwitchParameter
@@ -230,8 +230,8 @@ Accept pipeline input: True (ByPropertyName)
230230
Accept wildcard characters: False
231231
```
232232
233-
### -EnablePurgeProtection
234-
If specified, protection against immediate deletion is enabled for this vault; requires soft delete to be enabled as well.
233+
### -EnabledForTemplateDeployment
234+
Enables Azure Resource Manager to get secrets from this key vault when this key vault is referenced in a template deployment.
235235
236236
```yaml
237237
Type: System.Management.Automation.SwitchParameter
@@ -241,12 +241,12 @@ Aliases:
241241
Required: False
242242
Position: Named
243243
Default value: None
244-
Accept pipeline input: False
244+
Accept pipeline input: True (ByPropertyName)
245245
Accept wildcard characters: False
246246
```
247247
248-
### -EnableRbacAuthorization
249-
If specified, enables to authorize data actions by Role Based Access Control (RBAC), and then the access policies specified in vault properties will be ignored. Note that management actions are always authorized with RBAC.
248+
### -EnablePurgeProtection
249+
If specified, protection against immediate deletion is enabled for this vault; requires soft delete to be enabled as well.
250250
251251
```yaml
252252
Type: System.Management.Automation.SwitchParameter

src/KeyVault/KeyVault/help/Update-AzKeyVault.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ Update the state of an Azure key vault.
1515
### UpdateByNameParameterSet (Default)
1616
```
1717
Update-AzKeyVault -ResourceGroupName <String> -VaultName <String> [-EnablePurgeProtection]
18-
[-EnableRbacAuthorization <Boolean>] [-PublicNetworkAccess <String>] [-Tag <Hashtable>]
19-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
20-
[-SubscriptionId <String>] [<CommonParameters>]
18+
[-DisableRbacAuthorization <Boolean>] [-PublicNetworkAccess <String>] [-Tag <Hashtable>]
19+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [-SubscriptionId <String>]
20+
[<CommonParameters>]
2121
```
2222

2323
### UpdateByInputObjectParameterSet
2424
```
25-
Update-AzKeyVault -InputObject <PSKeyVault> [-EnablePurgeProtection] [-EnableRbacAuthorization <Boolean>]
26-
[-PublicNetworkAccess <String>] [-Tag <Hashtable>] [-DefaultProfile <IAzureContextContainer>]
27-
[-WhatIf] [-Confirm] [-SubscriptionId <String>] [<CommonParameters>]
25+
Update-AzKeyVault -InputObject <PSKeyVault> [-EnablePurgeProtection] [-DisableRbacAuthorization <Boolean>]
26+
[-PublicNetworkAccess <String>] [-Tag <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
27+
[-Confirm] [-SubscriptionId <String>] [<CommonParameters>]
2828
```
2929

3030
### UpdateByResourceIdParameterSet
3131
```
32-
Update-AzKeyVault -ResourceId <String> [-EnablePurgeProtection] [-EnableRbacAuthorization <Boolean>]
33-
[-PublicNetworkAccess <String>] [-Tag <Hashtable>] [-DefaultProfile <IAzureContextContainer>]
34-
[-WhatIf] [-Confirm] [-SubscriptionId <String>] [<CommonParameters>]
32+
Update-AzKeyVault -ResourceId <String> [-EnablePurgeProtection] [-DisableRbacAuthorization <Boolean>]
33+
[-PublicNetworkAccess <String>] [-Tag <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
34+
[-Confirm] [-SubscriptionId <String>] [<CommonParameters>]
3535
```
3636

3737
## DESCRIPTION
@@ -48,7 +48,7 @@ Enables purge protection using piping syntax.
4848

4949
### Example 2: Enable RBAC Authorization
5050
```powershell
51-
Get-AzKeyVault -VaultName $keyVaultName -ResourceGroupName $resourceGroupName | Update-AzKeyVault -EnableRbacAuthorization $true
51+
Get-AzKeyVault -VaultName $keyVaultName -ResourceGroupName $resourceGroupName | Update-AzKeyVault -DisableRbacAuthorization $false
5252
```
5353

5454
Enables RBAC Authorization using piping syntax.
@@ -84,13 +84,11 @@ Accept pipeline input: False
8484
Accept wildcard characters: False
8585
```
8686
87-
### -EnablePurgeProtection
88-
Enable the purge protection functionality for this key vault.
89-
Once enabled it cannot be disabled.
90-
It requires soft-delete to be turned on.
87+
### -DisableRbacAuthorization
88+
Disable or enable this key vault to authorize data actions by Role Based Access Control (RBAC).
9189
9290
```yaml
93-
Type: System.Management.Automation.SwitchParameter
91+
Type: System.Nullable`1[System.Boolean]
9492
Parameter Sets: (All)
9593
Aliases:
9694

@@ -101,11 +99,13 @@ Accept pipeline input: False
10199
Accept wildcard characters: False
102100
```
103101
104-
### -EnableRbacAuthorization
105-
Enable or disable this key vault to authorize data actions by Role Based Access Control (RBAC).
102+
### -EnablePurgeProtection
103+
Enable the purge protection functionality for this key vault.
104+
Once enabled it cannot be disabled.
105+
It requires soft-delete to be turned on.
106106
107107
```yaml
108-
Type: System.Nullable`1[System.Boolean]
108+
Type: System.Management.Automation.SwitchParameter
109109
Parameter Sets: (All)
110110
Aliases:
111111

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"Module","ClassName","Target","Severity","ProblemId","Description","Remediation"
2+
"Az.KeyVault","Microsoft.Azure.Commands.KeyVault.NewAzureKeyVault","New-AzKeyVault","0","2000","The cmdlet 'New-AzKeyVault' no longer supports the parameter 'EnableRbacAuthorization' and no alias was found for the original parameter name.","Add the parameter 'EnableRbacAuthorization' back to the cmdlet 'New-AzKeyVault', or add an alias to the original parameter name."
3+
"Az.KeyVault","Microsoft.Azure.Commands.KeyVault.NewAzureKeyVault","New-AzKeyVault","0","1050","The parameter set '__AllParameterSets' for cmdlet 'New-AzKeyVault' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'New-AzKeyVault'."
4+
"Az.KeyVault","Microsoft.Azure.Commands.KeyVault.UpdateTopLevelResourceCommand","Update-AzKeyVault","0","2000","The cmdlet 'Update-AzKeyVault' no longer supports the parameter 'EnableRbacAuthorization' and no alias was found for the original parameter name.","Add the parameter 'EnableRbacAuthorization' back to the cmdlet 'Update-AzKeyVault', or add an alias to the original parameter name."
5+
"Az.KeyVault","Microsoft.Azure.Commands.KeyVault.UpdateTopLevelResourceCommand","Update-AzKeyVault","0","1050","The parameter set 'UpdateByNameParameterSet' for cmdlet 'Update-AzKeyVault' has been removed.","Add parameter set 'UpdateByNameParameterSet' back to cmdlet 'Update-AzKeyVault'."
6+
"Az.KeyVault","Microsoft.Azure.Commands.KeyVault.UpdateTopLevelResourceCommand","Update-AzKeyVault","0","1050","The parameter set 'UpdateByInputObjectParameterSet' for cmdlet 'Update-AzKeyVault' has been removed.","Add parameter set 'UpdateByInputObjectParameterSet' back to cmdlet 'Update-AzKeyVault'."
7+
"Az.KeyVault","Microsoft.Azure.Commands.KeyVault.UpdateTopLevelResourceCommand","Update-AzKeyVault","0","1050","The parameter set 'UpdateByResourceIdParameterSet' for cmdlet 'Update-AzKeyVault' has been removed.","Add parameter set 'UpdateByResourceIdParameterSet' back to cmdlet 'Update-AzKeyVault'."
8+
"Az.KeyVault","Microsoft.Azure.Commands.KeyVault.UpdateTopLevelResourceCommand","Update-AzKeyVault","0","1050","The parameter set '__AllParameterSets' for cmdlet 'Update-AzKeyVault' has been removed.","Add parameter set '__AllParameterSets' back to cmdlet 'Update-AzKeyVault'."

0 commit comments

Comments
 (0)