Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Resources/Resources/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed parsing bug
* Updated ARM template What-If cmdlets to remove preview message from results
* Fixed an issue where template deployment cmdlets crash if `-WhatIf` is set at a higher scope [#13038]
* Added a default API version to be used in `Export-AzResourceGroup` cmdlet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public class NewAzureRoleAssignmentCommand : ResourcesBaseCmdlet
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ScopeWithSPN,
HelpMessage = "Condition to be applied to the RoleAssignment.")]
[ValidateNotNullOrEmpty]
public string Condition { get; set; }
public string Condition { get; set; } = null;

[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.Empty,
HelpMessage = "Version of the condition.")]
Expand All @@ -207,7 +207,7 @@ public class NewAzureRoleAssignmentCommand : ResourcesBaseCmdlet
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ScopeWithSPN,
HelpMessage = "Version of the condition.")]
[ValidateNotNullOrEmpty]
public string ConditionVersion { get; set; }
public string ConditionVersion { get; set; } = null;

[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.RoleIdWithScopeAndObjectId,
HelpMessage = "Role Id the principal is assigned to.")]
Expand Down Expand Up @@ -245,7 +245,7 @@ public override void ExecuteCmdlet()
this.ResourceType = RoleAssignment.ObjectType;
this.Scope = RoleAssignment.Scope;
Guid guid = Guid.Empty;
Guid.TryParse(RoleAssignment.RoleDefinitionId,out guid);
Guid.TryParse(RoleAssignment.RoleDefinitionId, out guid);
this.RoleDefinitionId = guid;
this.Description = RoleAssignment.Description;
this.Condition = RoleAssignment.Condition;
Expand All @@ -271,7 +271,9 @@ public override void ExecuteCmdlet()
}

}
double _conditionVersion = double.Parse((ConditionVersion ?? "2.0"));
// ensure that if ConditionVersion is empty in any way, it becomes null
ConditionVersion = string.IsNullOrEmpty(ConditionVersion) ? null : string.IsNullOrWhiteSpace(ConditionVersion) ? null : ConditionVersion;
double _conditionVersion = double.Parse(ConditionVersion ?? "2.0");
if (_conditionVersion < 2.0)
{
WriteExceptionError(new ArgumentException("Argument -ConditionVersion must be greater or equal than 2.0"));
Expand Down