From f3c0cb5783b14e791c5929cd9e2106da272fb0a3 Mon Sep 17 00:00:00 2001 From: Daniel Orozco Date: Tue, 1 Sep 2020 14:04:59 -0700 Subject: [PATCH 1/3] add missing null check --- .../RoleAssignments/SetAzureRoleAssignmentCommand.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Resources/Resources/RoleAssignments/SetAzureRoleAssignmentCommand.cs b/src/Resources/Resources/RoleAssignments/SetAzureRoleAssignmentCommand.cs index c60165391f4c..3ebcd281f1ef 100644 --- a/src/Resources/Resources/RoleAssignments/SetAzureRoleAssignmentCommand.cs +++ b/src/Resources/Resources/RoleAssignments/SetAzureRoleAssignmentCommand.cs @@ -111,9 +111,10 @@ public override void ExecuteCmdlet() throw new ArgumentException("Changing a property other than 'Description', 'Condition' or 'Condition Version' is currently not supported."); } + // TODO check cases when going from null to something or from something to null // If ConditionVersion is changed, validate it's in the allowed values - var oldConditionVersion = double.Parse(InputObject.ConditionVersion); - var newConditionVersion = double.Parse(fetchedRole.ConditionVersion); + var oldConditionVersion = double.Parse(InputObject.ConditionVersion ?? "0.0"); + var newConditionVersion = double.Parse(fetchedRole.ConditionVersion ?? "2.0"); // A condition version can change but currently we don't support downgrading to 1.0 // we only verify the change if it's a downgrade From 42240100b7be4e2a33de10a09ab7b19ee6e7290c Mon Sep 17 00:00:00 2001 From: Daniel Orozco Date: Tue, 1 Sep 2020 14:13:40 -0700 Subject: [PATCH 2/3] update docs --- src/Resources/Resources/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Resources/Resources/ChangeLog.md b/src/Resources/Resources/ChangeLog.md index 3fa8bb74181c..b2975d6680cb 100644 --- a/src/Resources/Resources/ChangeLog.md +++ b/src/Resources/Resources/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Added missing check for Set-AzRoleAssignment * Added breaking change attribute to `SubscriptionId` parameter of `Get-AzResourceGroupDeploymentOperation` * Updated ARM template What-If cmdlets to show "Ignore" resource changes last * Fixed secure and array parameter serialization issues for deployment cmdlets [#12773] From 286b58acccdaeefec9505832a064abd84f4e2ecc Mon Sep 17 00:00:00 2001 From: Daniel Orozco Date: Tue, 1 Sep 2020 14:17:12 -0700 Subject: [PATCH 3/3] Remove old TODO --- .../Resources/RoleAssignments/SetAzureRoleAssignmentCommand.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Resources/Resources/RoleAssignments/SetAzureRoleAssignmentCommand.cs b/src/Resources/Resources/RoleAssignments/SetAzureRoleAssignmentCommand.cs index 3ebcd281f1ef..66ec6ddcd7fa 100644 --- a/src/Resources/Resources/RoleAssignments/SetAzureRoleAssignmentCommand.cs +++ b/src/Resources/Resources/RoleAssignments/SetAzureRoleAssignmentCommand.cs @@ -111,7 +111,6 @@ public override void ExecuteCmdlet() throw new ArgumentException("Changing a property other than 'Description', 'Condition' or 'Condition Version' is currently not supported."); } - // TODO check cases when going from null to something or from something to null // If ConditionVersion is changed, validate it's in the allowed values var oldConditionVersion = double.Parse(InputObject.ConditionVersion ?? "0.0"); var newConditionVersion = double.Parse(fetchedRole.ConditionVersion ?? "2.0");