Skip to content

Commit

Permalink
Adding fixes (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregslack78 authored Apr 18, 2024
1 parent b7c40ba commit 251f98d
Show file tree
Hide file tree
Showing 18 changed files with 956 additions and 682 deletions.
Binary file added Docs/Images/createGHBranch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/Images/releases.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/Images/samplePRNotes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
399 changes: 288 additions & 111 deletions Docs/policy-exemptions.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Docs/settings-global-setting-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ EPAC has a concept of an environment identified by a string (unique per reposito
- `managedTenant`: Used when the `pacEnvironment` is in a lighthouse managed tenant, [see this example](#example-for-lighthouse-manged-tenant) It must contain:
- `managingTenantId` - The tenantId of the managing tenant.
- `managingTenantRootScope` - An array of all subscriptions that will need `additionalRoleAssignments` deployed to them.
- `defaultContext`: In rare cases (typicaslly only when deploying to a lighthouse managed tenant) the default context (Get-azContext) of a user/SPN running a plan will
be set to a suscription where that user/SPN does not have sufficient priveleges. Some checks have been built in so that in some cases when this happens EPAC is able to fix the context issue. When it is not, a `defaultContext` subscription name must be provided. This can be any subscription within the `deploymentRootScope`.

### DeployIfNotExists and Modify Policy Assignments need `managedIdentityLocation`

Expand Down
3 changes: 3 additions & 0 deletions Schemas/global-settings-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"deploymentRootScope": {
"type": "string"
},
"defaultContext": {
"type": "string"
},
"globalNotScopes": {
"type": "array",
"items": [
Expand Down
7 changes: 5 additions & 2 deletions Scripts/Deploy/Build-DeploymentPlans.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Clear-Variable -Name epacInfoStream -Scope global -Force -ErrorAction SilentlyCo
$InformationPreference = "Continue"

$pacEnvironment = Select-PacEnvironment $PacEnvironmentSelector -DefinitionsRootFolder $DefinitionsRootFolder -OutputFolder $OutputFolder -Interactive $Interactive
$null = Set-AzCloudTenantSubscription -Cloud $pacEnvironment.cloud -TenantId $pacEnvironment.tenantId -Interactive $pacEnvironment.interactive
$null = Set-AzCloudTenantSubscription -Cloud $pacEnvironment.cloud -TenantId $pacEnvironment.tenantId -Interactive $pacEnvironment.interactive -DeploymentDefaultContext $pacEnvironment.defaultContext

# Telemetry
if ($pacEnvironment.telemetryEnabled) {
Expand Down Expand Up @@ -177,7 +177,10 @@ elseif (!(Test-Path $policyExemptionsFolderForPacEnvironment -PathType Container
$exemptionsAreNotManagedMessage = "Policy Exemptions folder '$policyExemptionsFolderForPacEnvironment' for PaC environment $($pacEnvironment.pacSelector) not found. Exemptions not managed by this EPAC instance."
$exemptionsAreManaged = $false
}
if ($BuildExemptionsOnly) {
$localBuildExemptionsOnly = $BuildExemptionsOnly
# $localBuildExemptionsOnly = $true
# $VerbosePreference = "Continue"
if ($localBuildExemptionsOnly) {
$null = $warningMessages.Add("Building only the Exemptions plan. Policy, Policy Set, and Assignment plans will not be built.")
if ($exemptionsAreManaged) {
$buildSelections.buildPolicyExemptions = $true
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Deploy/Deploy-PolicyPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Clear-Variable -Name epacInfoStream -Scope global -Force -ErrorAction SilentlyCo

$InformationPreference = "Continue"
$pacEnvironment = Select-PacEnvironment $PacEnvironmentSelector -DefinitionsRootFolder $DefinitionsRootFolder -InputFolder $InputFolder -Interactive $Interactive
$null = Set-AzCloudTenantSubscription -Cloud $pacEnvironment.cloud -TenantId $pacEnvironment.tenantId -Interactive $pacEnvironment.interactive
$null = Set-AzCloudTenantSubscription -Cloud $pacEnvironment.cloud -TenantId $pacEnvironment.tenantId -Interactive $pacEnvironment.interactive -DeploymentDefaultContext $pacEnvironment.defaultContext
$throttleLimit = $VirtualCores * 2

# Telemetry
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Deploy/Deploy-RolesPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Clear-Variable -Name epacInfoStream -Scope global -Force -ErrorAction SilentlyCo

$InformationPreference = "Continue"
$pacEnvironment = Select-PacEnvironment $PacEnvironmentSelector -DefinitionsRootFolder $DefinitionsRootFolder -InputFolder $InputFolder -Interactive $Interactive
$null = Set-AzCloudTenantSubscription -Cloud $pacEnvironment.cloud -TenantId $pacEnvironment.tenantId -Interactive $pacEnvironment.interactive
$null = Set-AzCloudTenantSubscription -Cloud $pacEnvironment.cloud -TenantId $pacEnvironment.tenantId -Interactive $pacEnvironment.interactive -DeploymentDefaultContext $pacEnvironment.defaultContext

# Telemetry
if ($pacEnvironment.telemetryEnabled) {
Expand Down
4 changes: 2 additions & 2 deletions Scripts/Helpers/Build-AssignmentDefinitionAtLeaf.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ function Build-AssignmentDefinitionAtLeaf {
$requiredRoleAssignment = $null
if ($additionalRoleAssignment.crossTenant -eq $true) {
$requiredRoleAssignment = @{
scope = $scopeEntry.scope
scope = $additionalRoleAssignment.scope
roleDefinitionId = $roleDefinitionId
roleDisplayName = $roleDisplayName
description = "Policy Assignment '$id': additional cross tenant Role Assignment deployed by: '$($PacEnvironment.deployedBy)'"
Expand All @@ -620,7 +620,7 @@ function Build-AssignmentDefinitionAtLeaf {
}
else {
$requiredRoleAssignment = @{
scope = $scopeEntry.scope
scope = $additionalRoleAssignment.scope
roleDefinitionId = $roleDefinitionId
roleDisplayName = $roleDisplayName
description = "Policy Assignment '$id': additional Role Assignment deployed by: '$($PacEnvironment.deployedBy)'"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Helpers/Build-AssignmentPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function Build-AssignmentPlan {
-ReplacedAssignment $false `
-DeployedRoleAssignmentsByPrincipalId $deployedRoleAssignmentsByPrincipalId
if ($identityStatus.requiresRoleChanges) {
$null = $RoleAssignments.removed.AddRange($identityStatus.added)
$null = $RoleAssignments.removed.AddRange($identityStatus.removed)
$RoleAssignments.numberOfChanges += ($identityStatus.numberOfChanges)
}
if ($identityStatus.isUserAssigned) {
Expand Down
Loading

0 comments on commit 251f98d

Please sign in to comment.