chore(ci): migrate resource cleaner MI and CS PR auth SP to Bicep - #6172
chore(ci): migrate resource cleaner MI and CS PR auth SP to Bicep#6172galchammat wants to merge 2 commits into
Conversation
Replaces bash-managed identity creation in deploy-resource-cleaner.sh and create-pr-env-sp Makefile target with Bicep templates. Adds grantDeleteAccess param to acr-permissions.bicep (backward-compatible). Refs: ARO-27252, AROSLSRE-1351 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: galchammat The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Skipping CI for Draft Pull Request. |
|
/test all |
There was a problem hiding this comment.
Pull request overview
This PR migrates the remaining bash-managed identity / service principal setup in the CSPR path into declarative Bicep, leaving the existing shell script to deploy only the Kubernetes resources for the resource cleaner.
Changes:
- Add Bicep templates to create the resource-cleaner UAMI + fedcred + KV/ACR grants, and a separate subscription-scope template for Contributor.
- Add a Bicep template to create/manage the
cs-pr-authenticationEntra app/SP and assign AKS + Key Vault roles. - Update the cluster-service Makefile and resource-cleaner deploy script to consume Bicep outputs (client/tenant IDs) and remove bash-based Azure identity provisioning.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| dev-infrastructure/templates/dev-resource-cleaner.bicep | New RG-scope template for resource-cleaner UAMI, fedcred, and RBAC grants (KV + ACR). |
| dev-infrastructure/templates/dev-resource-cleaner-subscription.bicep | New subscription-scope template assigning Contributor to the resource-cleaner principal. |
| dev-infrastructure/templates/dev-cs-pr-auth-app.bicep | New template creating/managing the cs-pr-authentication app/SP and assigning AKS Contributor + KV Certificate User. |
| dev-infrastructure/modules/acr/acr-permissions.bicep | Adds independent grantDeleteAccess switch for AcrDelete role assignments. |
| dev-infrastructure/configurations/resource-cleaner.tmpl.bicepparam | New templatized parameter file for the resource-cleaner deployment. |
| dev-infrastructure/configurations/cs-pr-auth-app.tmpl.bicepparam | New templatized parameter file for the CS PR auth app deployment. |
| cluster-service/Makefile | Switches identity creation to Bicep deployments and wires outputs into the K8s deploy script. |
| cluster-service/cspr/deploy-resource-cleaner.sh | Removes Azure identity provisioning logic; requires AZURE_CLIENT_ID/AZURE_TENANT_ID env vars. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@copilot review |
AROSLSRE-1351 | ARO-27252
What
Replaces bash-managed identity creation in
deploy-resource-cleaner.shandcreate-pr-env-spMakefile target with declarative Bicep templates.dev-resource-cleaner.bicepcreates the managed identity, federated credential, KV roles (Certificates Officer, Secrets Officer), ACR delete access, and subscription Contributor via a separatedev-resource-cleaner-subscription.bicepdev-cs-pr-auth-app.bicepcreates the Entra app + SP viaentra/app.bicep, with AKS Contributor and KV Certificate User rolesgrantDeleteAccessparam (backward-compatible)deploy-resource-cleaner.shstripped to K8s-only (namespace, ConfigMap, CronJob); receivesAZURE_CLIENT_ID/AZURE_TENANT_IDfrom Bicep outputWhy
These were the last two bash-managed identity resources in the CSPR path. Moving them to Bicep makes them declarative, idempotent, and auditable — consistent with the rest of the IaC model.
Testing
No unit/integration/E2E tests — this is infrastructure-as-code. Verification is deployment-time:
az bicep lintpasses on all new templatesaz deployment group what-ifconfirms correct resource creationmake deploy-pr-env-depsin a personal dev env verifies MSI + fedcred + CronJob works end-to-endSpecial notes for your reviewer
cs-pr-authenticationapp needs a one-timeuniqueNamebackfill before first Bicep deploy (added to the backfill script in PR chore(ci): migrate mock identity SP creation to declarative Bicep #5976)PR Checklist
🤖 Generated with Claude Code