Skip to content

Commit

Permalink
578 scope counts are off based on the root scope type and 637 Outdate…
Browse files Browse the repository at this point in the history
…d Policy-Exemption Schema (#640)

* bug 578

* adding issue 637
  • Loading branch information
gregslack78 authored May 30, 2024
1 parent 761a790 commit 0fdceac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 8 additions & 8 deletions Schemas/policy-exemption-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@
"policyDefinitionReferenceIds": {
"type": "array"
},
"policyId": {
"policyDefinitionId": {
"type": "string"
},
"policyName": {
"policyDefinitionName": {
"type": "string"
},
"policySetId": {
"policySetDefinitionId": {
"type": "string"
},
"policySetName": {
"policySetDefinitionName": {
"type": "string"
},
"resourceSelectors": {
Expand All @@ -63,22 +63,22 @@
},
{
"required": [
"policyId"
"policyDefinitionId"
]
},
{
"required": [
"policyName"
"policyDefinitionName"
]
},
{
"required": [
"policySetId"
"policySetDefinitionId"
]
},
{
"required": [
"policySetName"
"policySetDefinitionName"
]
}
],
Expand Down
5 changes: 4 additions & 1 deletion Scripts/Helpers/Build-ScopeTableForDeploymentRootScope.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Build-ScopeTableForDeploymentRootScope {
ManagementGroup = $deploymentRootScopeManagementGroupName
}
}
elseif ($deploymentRootScope.StartsWith("/subscriptions/")) {
elseif ($deploymentRootScope.StartsWith("/subscriptions/") -and $deploymentRootScope -notLike "*/resourceGroups/*") {
$deploymentRootScopeSubscriptionId = $deploymentRootScope -replace "/subscriptions/"
$scopeSplat = @{
Subscription = $deploymentRootScopeSubscriptionId
Expand Down Expand Up @@ -136,6 +136,9 @@ function Build-ScopeTableForDeploymentRootScope {
$numberOfManagementGroups-- # subtract 1 for the root scope
Write-Information " Management groups = $($numberOfManagementGroups)"
}
if ($deploymentRootScope.StartsWith("/subscriptions/")) {
$numberOfSubscriptions-- # subtract 1 for the root scope
}
Write-Information " Subscriptions = $($numberOfSubscriptions)"
Write-Information " Resource groups = $($numberofResourceGroups)"

Expand Down

0 comments on commit 0fdceac

Please sign in to comment.