Skip to content

Commit

Permalink
Merge pull request #91 from Azure/90-empty-globalnotscopes-property-f…
Browse files Browse the repository at this point in the history
…or-pacenvironment-fails-parameter-validation

Fixing bug with empty global notScopes
  • Loading branch information
techlake authored Nov 9, 2022
2 parents a8835db + 24a5ac9 commit ff686cc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if ($PlanFile -eq "") {
$PlanFile = $pacEnvironment.policyPlanOutputFile
}

# Getting existing Policy Assignmentscls
# Getting existing Policy Assignments
$existingAssignments = $null
$scopeTreeInfo = Get-AzScopeTree `
-tenantId $pacEnvironment.tenantId `
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Build-AzPolicyAssignmentsPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Build-AzPolicyAssignmentsPlan {
[hashtable] $rootScope,
[string] $rootScopeId,
[hashtable] $scopeTreeInfo,
[array] $globalNotScopeList,
[array] $globalNotScopeList = @(),
[string] $managedIdentityLocation,
[hashtable] $allPolicyDefinitions,
[hashtable] $customPolicyDefinitions,
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Build-AzPolicyDefinitionsForInitiative.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function Build-AzPolicyDefinitionsForInitiative {

)

######## validating each Policy Definition needed in Inititaive exists ###########
######## validating each Policy Definition needed in Initiative exists ###########
Write-Verbose " Check existence of referenced policyDefinitionIDs and build new array"

$usingUndefinedReference = $false
Expand Down
20 changes: 10 additions & 10 deletions Scripts/Helpers/Get-AzAssignmentsAtScopeRecursive.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -331,16 +331,16 @@ function Get-AzAssignmentsAtSpecificScope {
function Get-AzAssignmentsAtScopeRecursive {
[CmdletBinding()]
param(
[parameter(Mandatory = $True)] [object] $scopeTreeInfo,
[parameter(Mandatory = $True)] [string[]] $notScopeIn,
[parameter(Mandatory = $false)] [bool] $includeResourceGroups = $false,
[parameter(Mandatory = $false)] [bool] $getAssignments = $true,
[parameter(Mandatory = $false)] [bool] $getExemptions = $true,
[Parameter(Mandatory = $false)] [int] $expiringInDays = 7,
[parameter(Mandatory = $false)] [bool] $getRemediations = $false,
[parameter(Mandatory = $false)] [hashtable] $allPolicyDefinitions = $null,
[parameter(Mandatory = $false)] [hashtable] $allInitiativeDefinitions = $null,
[switch] $supressRoleAssignments
[object] $scopeTreeInfo,
[string[]] $notScopeIn = @(),
[bool] $includeResourceGroups = $false,
[bool] $getAssignments = $true,
[bool] $getExemptions = $true,
[int] $expiringInDays = 7,
[bool] $getRemediations = $false,
[hashtable] $allPolicyDefinitions = $null,
[hashtable] $allInitiativeDefinitions = $null,
[switch] $supressRoleAssignments
)

[array] $subscriptionIds = @()
Expand Down
1 change: 0 additions & 1 deletion Scripts/Helpers/Select-PacEnvironment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function Select-PacEnvironment {
[array] $globalNotScopeList = @()
if ($globalSettings.globalNotScopes) {
$globalNotScopes = $globalSettings.globalNotScopes
$globalNotScopeList = @()
if ($globalNotScopes.ContainsKey($pacEnvironmentSelector)) {
$globalNotScopeList += $globalNotScopes[$pacEnvironmentSelector]
}
Expand Down

0 comments on commit ff686cc

Please sign in to comment.