Commit 20a2942
authored
Fix production container image deployment by granting ACR pull access via Bicep infrastructure (#711)
### Summary & motivation
Fix an issue where container images were not deployed to production due
to incorrect federated credentials when attempting to pull images from
the staging container registry. The previous approach relied on GitHub
Actions federated credentials, which failed because the production
workflow was not using the correct federated credential to access
staging.
To resolve this, Bicep infrastructure has been updated to grant the
production service principal ACR pull permissions on the staging
container registry during infrastructure deployment. This ensures that
production can securely pull images from staging without requiring
federated identity access.
This change makes the GitHub workflow much cleaner, as there is no
longer a need for production workflows to log in to staging. However,
this change introduced a new challenge: the GitHub environment variable
`PRODUCTION_SERVICE_PRINCIPAL_ID` could not be used for role assignment.
The required Object ID is not accessible from GitHub Actions because
Microsoft Entra ID cannot be queried from the workflow. To work around
this, a new `PRODUCTION_SERVICE_PRINCIPAL_OBJECT_ID` environment
variable has been introduced, and the `configure-continuous-deployments`
CLI has been updated to create this.
### Downstream projects
To support this change, you must create a new GitHub variable named
`PRODUCTION_SERVICE_PRINCIPAL_OBJECT_ID` before merging this into
`main`.
#### How to obtain the required object ID:
1. **Preferred method**: Re-run `pp configure-continuous-deployments`
using the Developer CLI, which will recreate all your GitHub variables
(with the same values) and add the new
`PRODUCTION_SERVICE_PRINCIPAL_OBJECT_ID`.
2. **Manual method**: If re-running the CLI is not feasible, retrieve
the object ID manually:
- Go to Azure Portal.
- Navigate to **Microsoft Entra ID > Enterprise Applications** (not to
be confused with App Registrations).
- Search for `GitHub - Production - your-github-org/your-github-repo`.
- Copy the **Object ID** and create a new
`PRODUCTION_SERVICE_PRINCIPAL_OBJECT_ID` GitHub variable with this
value.
If this is not set or set with wrong ID, deployment of staging
infrastructure will fail with errors such as
`"PrincipalTypeNotSupported"` or `"InvalidPrincipalId"`.
### Checklist
- [x] I have added tests, or done manual regression tests
- [x] I have updated the documentation, if necessaryFile tree
6 files changed
+30
-18
lines changed- .github/workflows
- cloud-infrastructure/environment
- developer-cli/Commands
6 files changed
+30
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 117 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 118 | + | |
132 | 119 | | |
133 | 120 | | |
134 | 121 | | |
| |||
144 | 131 | | |
145 | 132 | | |
146 | 133 | | |
147 | | - | |
148 | 134 | | |
149 | 135 | | |
150 | 136 | | |
| |||
170 | 156 | | |
171 | 157 | | |
172 | 158 | | |
173 | | - | |
| 159 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
70 | | - | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
102 | | - | |
| 106 | + | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
13 | 20 | | |
14 | 21 | | |
15 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
26 | 37 | | |
27 | 38 | | |
28 | 39 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
| 512 | + | |
512 | 513 | | |
513 | 514 | | |
514 | 515 | | |
| |||
724 | 725 | | |
725 | 726 | | |
726 | 727 | | |
| 728 | + | |
727 | 729 | | |
728 | 730 | | |
729 | 731 | | |
| |||
1058 | 1060 | | |
1059 | 1061 | | |
1060 | 1062 | | |
| 1063 | + | |
1061 | 1064 | | |
1062 | 1065 | | |
1063 | 1066 | | |
| |||
0 commit comments