Commit 2bbc102
Small improvements to process flow and communication (#190)
## Purpose
* Fixes a global ACR name collision that caused
`External-Configurator.ps1` to silently skip container registry creation
for any user who kept the default cluster name (`iot-ops-cluster`). The
auto-generated name `iotopsclusteracr` is already taken in Azure; the
fix appends a 6-character subscription ID suffix to make the name unique
per-subscription while keeping it deterministic across re-runs.
* Fixes an indefinite hang in `External-Configurator.ps1` and
`grant_entra_id_roles.ps1` when required Azure CLI extensions
(`azure-iot-ops`, `connectedk8s`, `k8s-extension`) are not installed.
Both scripts now check for all three extensions at startup, print the
exact install commands, and exit immediately rather than blocking.
## Does this introduce a breaking change?
```
[ ] Yes
[x] No
```
Existing users who already set a custom `container_registry` value are
unaffected. Users who relied on the old auto-generated name
(`<cluster>acr`) will get a new name on first run — but since the old
name was globally taken and ACR creation was silently skipped anyway,
there is no working state to break.
## Pull Request Type
```
[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:
```
## How to Test
* Get the code
```
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
```
* Test Issue 1 (ACR name collision):
```powershell
# Use the default cluster name so the suffix logic is exercised
$env:AKSEDGE_CLUSTER_NAME = "iot-ops-cluster"
# Leave AZURE_CONTAINER_REGISTRY unset
cd quickstart/external_configuration
.\External-Configurator.ps1 -WhatIf # or run normally in a test subscription
```
* Test Issue 2 (extension check):
```powershell
# Temporarily rename an extension to simulate it being absent
az extension remove --name connectedk8s
cd quickstart/external_configuration
.\External-Configurator.ps1
# Expect: immediate error listing missing extensions with install commands, no hang
.\grant_entra_id_roles.ps1
# Expect: same immediate error
# Restore
az extension add --upgrade --name connectedk8s
```
## What to Check
* ACR name printed in the yellow notice block includes a 6-character
suffix derived from the subscription ID (not the bare `<cluster>acr`
form).
* Re-running the script with the same subscription produces the same ACR
name (idempotent).
* Setting `container_registry` in `aio_config.json` or
`$env:AZURE_CONTAINER_REGISTRY` bypasses the auto-generation block
entirely — the yellow notice does not appear.
* With a missing extension, both `External-Configurator.ps1` and
`grant_entra_id_roles.ps1` exit within seconds with a red error listing
the missing extensions and the `az extension add` commands to fix them.
* With all three extensions installed, both scripts proceed normally
past the extension check.
## Other Information
The subscription ID suffix approach was chosen over a random suffix
because it keeps the name stable across re-runs (important for
idempotency) while still being unique across different Azure tenants and
subscriptions. The first 6 hex characters of a subscription ID provide
sufficient entropy for this purpose.
---------
Co-authored-by: william_harding <wharding@microsoft.com>1 parent b52aa96 commit 2bbc102
3 files changed
Lines changed: 55 additions & 15 deletions
Lines changed: 30 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
219 | 228 | | |
220 | 229 | | |
221 | 230 | | |
| |||
661 | 670 | | |
662 | 671 | | |
663 | 672 | | |
664 | | - | |
665 | | - | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
666 | 678 | | |
667 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
668 | 685 | | |
669 | 686 | | |
670 | 687 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
360 | 382 | | |
361 | 383 | | |
362 | 384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
0 commit comments