Azure-Samples / Azure-Samples/Microhack-Ask-Analyze-Act
Failed to execute `azd up`
- Dominant language
- HCL
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Description
During `azd up`, the `preprovision` hook (`scripts/preprovision.ps1`) fails when calling `Set-AzContext`, regardless of the value format used for `TENANT_DOMAIN`.
Also, for `TENANT_DOMAIN`, which value should be assigned: "TME01.onmicrosoft.com" or "70a036f6-8e4d-4615-bad6-149c02e7720d"? Please also let me know if there is anything incorrect in the test steps or environment variables.
Two different failure modes are observed depending on the value of `TENANT_DOMAIN`:
---
### Case 1: `TENANT_DOMAIN` set to domain name (e.g. `TME01.onmicrosoft.com`)
**Environment config:**
```
TENANT_DOMAIN="TME01.onmicrosoft.com"
AZURE_SUBSCRIPTION_ID="4d042dc6-fe17-4698-a23f-ec6a8d1e98f4"
```
**Error:**
```
Set-AzContext: D:\...\scripts\preprovision.ps1:83:16
Line |
83 | $context = Set-AzContext @setParams
| ~~~~~~~~~~~~~~~~~~~~~~~~
| Please provide a valid tenant or a valid subscription.
```
`Set-AzContext` does not accept a domain name string as the `-Tenant` parameter — it requires a Tenant ID (GUID).
---
### Case 2: `TENANT_DOMAIN` set to Tenant ID (e.g. `70a036f6-8e4d-4615-bad6-149c02e7720d`)
If passing a UUID is the expected behavior, I am missing two permissions on my side — the `Entra role Global Administrator` and the `Azure role Owner on the subscription` — which may prevent me from continuing the testing.
**Environment config:**
```
TENANT_DOMAIN="70a036f6-8e4d-4615-bad6-149c02e7720d"
AZURE_SUBSCRIPTION_ID="4d042dc6-fe17-4698-a23f-ec6a8d1e98f4"
```
**Error:**
The `Set-AzContext` call succeeds, but two prerequisite checks fail:
```
Check Status Detail
----- ------ ------
Entra role 'Global Administrator' FAIL Check failed: [Authorization_RequestDenied] : Insufficien
Azure role 'Owner' on subscription FAIL No Owner assignment found on 4d042dc6-fe17-4698-a23f-ec6a
Resource provider 'Microsoft.Fabric' registered PASS RegistrationState is Registered.
Resource provider 'Microsoft.PowerPlatform' registered PASS RegistrationState is Registered.
2 prerequisite check(s) failed. Resolve the items marked FAIL above and retry.
```
---
## Environment
- Azd version: azd version 1.28.1 (commit 3cf6db5881d8b24bb497e1470a972f4e28eb0256) (stable)
- OS: Windows
- .env file:
| Variable | Value |
|----------|-------|
| `APP_SERVICE_PLAN_SKU` | `B1` |
| `AZURE_APP_SERVICE_WEB_APP_NAME` | `app-sqlhack-hack1` |
| `AZURE_ENV_NAME` | `xutottyd3` |
| `AZURE_LOCATION` | `swedencentral` |
| `AZURE_SUBSCRIPTION_ID` | `4d042dc6-fe17-4698-a23f-ec6a8d1e98f4` |
| `SQL_ADMIN_LOGIN` | `sqlmiadmin` |
| `SQL_MI_ENTRA_ADMIN_LOGIN` | `admin@TME01.onmicrosoft.com` |
| `SQL_MI_ENTRA_ADMIN_OBJECT_ID` | `720b71e5-df66-4cb9-9f7f-683ed60ab80e` |
| `SQL_PASSWORD` | `Password123\!` |
| `TAILSPIN_TOYS_USER_DATABASE_COUNT` | `2` |
| `TENANT_DOMAIN` | `TME01.onmicrosoft.com` / `70a036f6-8e4d-4615-bad6-149c02e7720d` |
## Steps to Reproduce
1. Clone the repository and configure the `.env` file as shown above.
2. Run `azd up`.
## Expected Behavior
`azd up` executes successfully.
@henrikmotzkus, @hemarina for notification.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with scripts/preprovision.ps1, especially the Set-AzContext call at line 83, then reproduce the failure with azd up using each TENANT_DOMAIN format shown. Review the prerequisite-check output for the Global Administrator and subscription Owner requirements. Done means the intended tenant value and permissions are documented or azd up completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100