Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to remove old assignment and 10 char limit #15

Merged
merged 5 commits into from
Sep 27, 2023
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
31 changes: 31 additions & 0 deletions docs/content/patterns/alz/Known-Issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,34 @@ When a role or a role assignement is removed, some orphaned object can still app
2. Select the management group (corresponding to the value entered for the *enterpriseScaleCompanyPrefix* during the deployment) were AMBA deployment was targeted to
3. Select ***Access control (IAM)***
4. Under the ***Contributor*** role, select all records named ***Identity not found*** entry and click ***Remove***

## Failed to deploy to a different location

### Error includes

*Error: Code=InvalidDeploymentLocation; Message=Invalid deployment location 'westeurope'. The deployment 'ALZARM' already exists in location 'uksouth'.*

### Cause

A deployment has been performed using one region (i.e. 'uksouth') in the command line. A subsequent cleanup is performed to allow a second deploy against a different region (i.e. 'westeurope'). Deployment entries still exists from the previous operation, so a region conflict is detected blocking you to run another deployment using a different region.

### Resolution

To resolve this issue, follow the steps below:

1. Navigate to ***Management Groups***
2. Select the management group (corresponding to the value entered for the *enterpriseScaleCompanyPrefix* during the deployment) were AMBA deployment was targeted to
3. Click ***Deployment***
4. Select all the deployment instances related to AMBA and click ***Delete***.

{{< hint type=Important >}}
To recognize the deployment names belonging to AMBA, select those whose names start with:

1. amba-
2. pid-
3. alzArm
4. preparingToLaunch

If you deployed AMBA just one time, you have 14 deployment instances

{{< /hint >}}
3 changes: 1 addition & 2 deletions patterns/alz/alzArm.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
"parameters": {
"enterpriseScaleCompanyPrefix": {
"type": "string",
"maxLength": 10,
"metadata": {
"description": "Provide a prefix (max 10 characters, unique at tenant-scope) for the Management Group hierarchy and other resources created as part of Enterprise-scale."
"description": "Provide a prefix (unique at tenant-scope) for the Management Group hierarchy and other resources created as part of Enterprise-scale."
}
},
"telemetryOptOut": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"properties": {
"principalType": "ServicePrincipal",
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('rbacContributor'))]",
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaConnectivity), '2019-09-01', 'Full' ).identity.principalId)]"
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaConnectivity), '2019-09-01', 'Full' ).identity.principalId)]",
"description": "_deployed_by_amba"
}
}
],
Expand Down
3 changes: 2 additions & 1 deletion patterns/alz/policyAssignments/DINE-IdentityAssignment.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"properties": {
"principalType": "ServicePrincipal",
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('rbacContributor'))]",
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaIdentity), '2019-09-01', 'Full' ).identity.principalId)]"
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaIdentity), '2019-09-01', 'Full' ).identity.principalId)]",
"description": "_deployed_by_amba"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"properties": {
"principalType": "ServicePrincipal",
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('rbacContributor'))]",
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaLandingZone), '2019-09-01', 'Full' ).identity.principalId)]"
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaLandingZone), '2019-09-01', 'Full' ).identity.principalId)]",
"description": "_deployed_by_amba"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"properties": {
"principalType": "ServicePrincipal",
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('rbacContributor'))]",
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaManagement), '2019-09-01', 'Full' ).identity.principalId)]"
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaManagement), '2019-09-01', 'Full' ).identity.principalId)]",
"description": "_deployed_by_amba"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"properties": {
"principalType": "ServicePrincipal",
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('rbacContributor'))]",
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaServiceHealth), '2019-09-01', 'Full' ).identity.principalId)]"
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').ambaServiceHealth), '2019-09-01', 'Full' ).identity.principalId)]",
"description": "_deployed_by_amba"
}
}
],
Expand Down
5 changes: 2 additions & 3 deletions patterns/alz/policyDefinitions/policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
"_generator": {
"name": "bicep",
"version": "0.19.5.34762",
"templateHash": "14194738762871678875"
"templateHash": "6797539924020692135"
}
},
"parameters": {
"topLevelManagementGroupPrefix": {
"type": "string",
"defaultValue": "alz",
"maxLength": 10,
"metadata": {
"description": "Provide a prefix (max 10 characters, unique at tenant-scope) for the Management Group hierarchy and other resources created as part of an Azure landing zone. DEFAULT VALUE = \"alz\"",
"description": "Provide a prefix (unique at tenant-scope) for the Management Group hierarchy and other resources created as part of an Azure landing zone. DEFAULT VALUE = \"alz\"",
"message": "The JSON version of this file is programatically generated from Bicep. PLEASE DO NOT UPDATE MANUALLY!!"
}
},
Expand Down
2 changes: 1 addition & 1 deletion patterns/alz/scripts/Start-AMBACleanup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ ForEach ($identity in $policyAssignmentIdentities) {

ForEach ($roleAssignment in $identityRoleAssignments) {

If ($roleAssignment.Description -like '*_deployed_by_amba*') {
If ($roleAssignment.Description -eq '_deployed_by_amba') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see "_deployed_by_amba" was added in the metadata of the role assignment, however here the if statement the evaluations is done on ".Description" can you validate whether that is correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as the script line goes, I made the change to look for exact value (case insensitive). Wildcard in this case can lead to something different added by the customer ... very unlikely but possible.

Here they are the screenshots:

  • Successful deployment with a pseudoMG name which is more than 10 chars
    image

  • Description for role assignment correctly populated
    image

  • Successful cleanup
    image

image

image

  • Successful deployment
    image

image

$roleAssignments += $roleAssignment
}
}
Expand Down
3 changes: 1 addition & 2 deletions patterns/alz/templates/policies.bicep
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
targetScope = 'managementGroup'

@metadata({ message: 'The JSON version of this file is programatically generated from Bicep. PLEASE DO NOT UPDATE MANUALLY!!' })
@description('Provide a prefix (max 10 characters, unique at tenant-scope) for the Management Group hierarchy and other resources created as part of an Azure landing zone. DEFAULT VALUE = "alz"')
@maxLength(10)
@description('Provide a prefix (unique at tenant-scope) for the Management Group hierarchy and other resources created as part of an Azure landing zone. DEFAULT VALUE = "alz"')
param topLevelManagementGroupPrefix string = 'alz'

@description('Optionally set the deployment location for policies with Deploy If Not Exists effect. DEFAULT VALUE = "deployment().location"')
Expand Down