diff --git a/plugin/skills/azure-deploy/references/recipes/azd/errors.md b/plugin/skills/azure-deploy/references/recipes/azd/errors.md index 180b8a2e5..25871fe7b 100644 --- a/plugin/skills/azure-deploy/references/recipes/azd/errors.md +++ b/plugin/skills/azure-deploy/references/recipes/azd/errors.md @@ -1,5 +1,7 @@ # AZD Errors +## Common Errors + | Error | Resolution | |-------|------------| | Not authenticated | `azd auth login` | @@ -9,6 +11,84 @@ | Package failed | Verify Dockerfile and dependencies | | Quota exceeded | Request increase or change region | +## TypeScript Functions Deployment Errors + +### Error: "sh: 1: tsc: Permission denied" + +**Root Cause:** Local `node_modules/` uploaded with wrong permissions OR TypeScript source excluded. + +**Solution:** + +1. Ensure `.funcignore` includes `node_modules/` and does NOT exclude `*.ts` or `tsconfig.json` +2. Ensure `azure.yaml` uses `language: ts` for remote build +3. Redeploy: `azd deploy --no-prompt` + +**For detailed .funcignore configuration**, see [azure-prepare skill typescript-funcignore.md](../../../../azure-prepare/references/recipes/azd/typescript-funcignore.md) + +### Alternative: Switch to Local Build + +Update `azure.yaml` to use `language: js` with a `prepackage` hook to run `npm run build`. + +## Application Insights Errors + +### Error: No Traces in Application Insights + +**Symptom:** Function App running but no telemetry in Application Insights. + +**Common Causes:** +1. Missing `APPLICATIONINSIGHTS_AUTHENTICATION_STRING` app setting (when `DisableLocalAuth: true`) +2. Missing `Monitoring Metrics Publisher` RBAC role +3. Incorrect client ID for user-assigned identity +4. Managed identity not enabled + +**Quick Fix - Add Required Bicep:** +```bicep +// App setting +APPLICATIONINSIGHTS_AUTHENTICATION_STRING: 'Authorization=AAD' + +// Role assignment +resource appInsightsRole 'Microsoft.Authorization/roleAssignments@2022-04-01' = { + name: guid(functionApp.id, appInsights.id) + scope: appInsights + properties: { + roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '3913510d-42f4-4e42-8a64-420c390055eb') + principalId: functionApp.identity.principalId + principalType: 'ServicePrincipal' + } +} +``` + +**Verify:** +```bash +az functionapp identity show -g -n +az functionapp config appsettings list -g -n --query "[?name=='APPLICATIONINSIGHTS_AUTHENTICATION_STRING']" +``` + +Wait 5-10 minutes for propagation. + +**For complete setup**, see [azure-prepare skill appinsights-auth.md](../../../../azure-prepare/references/recipes/azd/appinsights-auth.md) + +## Policy Compliance Errors + +### Error: RequestDisallowedByPolicy - Local Auth Not Allowed + +**Error Message:** +``` +RequestDisallowedByPolicy: Resource 'evhns-xxx' was disallowed by policy. +Reasons: 'Local authentication methods are not allowed.' +``` + +**Affected Services:** Event Hubs, Service Bus, Storage, Application Insights + +**Solution - Add to Bicep:** +- Event Hubs/Service Bus: `disableLocalAuth: true` +- Storage: `allowSharedKeyAccess: false` +- Application Insights: `DisableLocalAuth: true` + +Then reprovision: `azd provision --no-prompt` + +**For complete examples**, see [azure-prepare skill enterprise-policy.md](../../../../azure-prepare/references/recipes/azd/enterprise-policy.md) + ## Retry ```bash diff --git a/plugin/skills/azure-prepare/SKILL.md b/plugin/skills/azure-prepare/SKILL.md index 3e9089a6a..9f9d6e3d4 100644 --- a/plugin/skills/azure-prepare/SKILL.md +++ b/plugin/skills/azure-prepare/SKILL.md @@ -31,6 +31,7 @@ Activate this skill when user wants to: 4. Follow linked references for best practices and guidance 5. Update `.azure/preparation-manifest.md` after each phase 6. Invoke **azure-validate** before any deployment +7. **ALWAYS use `azd init -t