Azure / Azure/Azure-Landing-Zones

[Question/bug]: Adding existing Policy Initiative Definition

Open
#3,986 3 comments 0 reactions 1 assignee Claimed by @oZakari View on GitHub
Product: Accelerator :zap: Product: Bicep (AVM) Topic: Policy :pencil:
Dominant language
PowerShell
Stars
96
Forks
70
Avg merge
3d 1h
Merged PRs (30d)
7

Description

### Which product(s) are you raising for?

ALZ Bicep (AVM)

### What versions of the tools are you using?

_No response_

### What is the bug?

Hi,

So we've followed the guide for deploying [landing zone](https://azure.github.io/Azure-Landing-Zones/accelerator/) with bicep and GitHub. Deployment and everything worked perfekt.

Next we wanted to add some standard definitions e.g ISO/IEC 27001 2022 or NIST-SP-800-53-Rev5 Policies.

To test this we updated the main.bicepparam for sandbox (templates\core\governance\mgmt-groups\sandbox\main.bicepparam).

First we added NIST-SP-800-53-Rev5, commited branch to github and saw "01 Azure Landing Zones Continuous Integration" triggered and the CI / What If

`customerPolicyAssignments: [
{
name: 'NIST-SP-800-53-Rev5'
location: 'westeurope'
identity: {
type: 'SystemAssigned'
}
properties: {
displayName: 'NIST SP 800-53 Rev. 5'
policyDefinitionId: '/providers/Microsoft.Authorization/policySetDefinitions/179d1daa-458f-4e47-8086-2a68d0d6c38f'
scope: '/providers/Microsoft.Management/managementGroups/sandbox'
enforcementMode: 'DoNotEnforce'
parameters: {
}
nonComplianceMessages: [
{
message: 'NIST SP 800-53 Rev. 5 controls {enforcementMode} be enforced.'
}
]
}
}
]`

Next we wanted to change to ISO/IEC 27001 2022. So we replaced the customerPolicyAssignments with

` customerPolicyAssignments: [
{
name: 'ISO/IEC 27001 2022'
location: 'westeurope'
identity: {
type: 'SystemAssigned'
}
properties: {
displayName: 'ISO/IEC 27001 2022'
policyDefinitionId: '/providers/Microsoft.Authorization/policySetDefinitions/5e4ff661-23bf-42fa-8e3a-309a55091cc7'
scope: '/providers/Microsoft.Management/managementGroups/sandbox'
enforcementMode: 'DoNotEnforce'
parameters: {
}
nonComplianceMessages: [
{
message: 'ISO/IEC 27001 2022 {enforcementMode} be enforced.'
}
]
}
}
]`

But the CI / What If do not log out the new policy. Is it a bug or are we doing it completely wrong?

Note that we have not run the workflow "02 Azure Landing Zones Continuous Delivery" as we would like to confirm that it's ok with the CI first.

### Log Output

```Text
NIST-SP-800-53-Rev5 log from GitHub:
The deployment will update the following scopes:

Scope: /

= Microsoft.Management/ManagementGroups/sandbox [2021-04-01]

Scope: /providers/Microsoft.Management/ManagementGroups/sandbox

+ Microsoft.Authorization/policyAssignments/NIST-SP-800-53-Rev5 [2025-01-01]

apiVersion: "2025-01-01"
id: "/providers/Microsoft.Management/managementGroups/sandbox/providers/Microsoft.Authorization/policyAssignments/NIST-SP-800-53-Rev5"
identity.type: "SystemAssigned"
location: "westeurope"
name: "NIST-SP-800-53-Rev5"
properties.displayName: "NIST SP 800-53 Rev. 5"
properties.enforcementMode: "DoNotEnforce"
properties.nonComplianceMessages: [
0:

message: "NIST SP 800-53 Rev. 5 controls {enforcementMode} be enforced."

]
properties.policyDefinitionId: "/providers/Microsoft.Authorization/policySetDefinitions/179d1daa-458f-4e47-8086-2a68d0d6c38f"
type: "Microsoft.Authorization/policyAssignments"

~ Microsoft.Authorization/policyAssignments/Enforce-ALZ-Sandbox [2025-01-01]
- properties.definitionVersion: "1.*.*"

Resource changes: 1 to create, 1 to modify, 1 no change.

ISO/IEC 27001 2022 log from GitHub:

The deployment will update the following scope:
Scope: /

= Microsoft.Management/ManagementGroups/sandbox [2021-04-01]

Resource changes: 1 no change.
Diagnostics (35):
(/providers/Microsoft.Management/managementGroups/sandbox/providers/Microsoft.Resources/deployments/crmkymazefna2-alz-mg-pol-asi-sandbox-mbpnvlitmfvdm) A nested deployment got short-circuited and all its resources got skipped from validation. This is due to a nested template having a parameter that was not fully evaluated (e.g. contains a reference() function). Please see https://aka.ms/WhatIfEvalStopped for more guidance. (NestedDeploymentShortCircuited)
(/providers/Microsoft.Management/managementGroups//providers/Microsoft.Resources/deployments/crmkymazefna2-alz-pol-asi-waitsandbox-8) When nested deployments are expanded, all its inner resources are retrieved for further validation. This process is performed in batch of: '10' at a time. Nested deployments exceeding this batch count are skipped from expansion. (NestedDeploymentSkippedFromInternalExpansion)
```

### Screenshot(s)

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.