Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
GitHub Copilot for Azure plugin providing Azure service management and development assistance inside Claude Code and IDEs.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/services/functions/global-rules.md
1# Global Rules23These rules apply to ALL phases of the migration skill.45## Destructive Action Policy67⛔ **NEVER** perform destructive actions without explicit user confirmation via `ask_user`:8- Deleting files or directories9- Overwriting existing code10- Deploying to production environments11- Modifying existing Azure resources12- Removing AWS resources1314## User Confirmation Required1516Always use `ask_user` before:17- Selecting Azure subscription18- Selecting Azure region/location19- Deploying infrastructure20- Making breaking changes to existing code2122## Best Practices2324- Always use `mcp_azure_mcp_get_azure_bestpractices` tool before generating Azure code25- Prefer managed identity over connection strings26- **Always use the latest supported language runtime** — check [supported languages](https://learn.microsoft.com/en-us/azure/azure-functions/supported-languages) for the newest GA version. Never default to older versions27- **Always prefer bindings over SDKs** — use `input.storageBlob()`, `output.storageBlob()`, `app.storageQueue()`, etc. instead of `BlobServiceClient`, `QueueClient`, or other SDK clients. Only use SDK when no binding exists for the service28- Follow Azure naming conventions29- Use Flex Consumption hosting plan for new Functions3031## Identity-First Authentication (Zero API Keys)3233> Enterprise subscriptions commonly enforce policies that block local auth. Always design for identity-based access from the start.3435- **Storage accounts**: Set `allowSharedKeyAccess: false`. Use identity-based connections with `AzureWebJobsStorage__credential`, `__clientId`, and service-specific URIs (`__blobServiceUri`, `__queueServiceUri`, etc.)36- **Cognitive Services**: Set `disableLocalAuth: true`. Use UAMI + RBAC role (e.g., Cognitive Services User) instead of API keys37- **Application Insights**: Set `disableLocalAuth: true`. Use `APPLICATIONINSIGHTS_AUTHENTICATION_STRING` with `ClientId=<uamiClientId>;Authorization=AAD`38- **DefaultAzureCredential with UAMI**: When using User Assigned Managed Identity, always pass `managedIdentityClientId` explicitly:39```javascript40const credential = new DefaultAzureCredential({41managedIdentityClientId: process.env.AZURE_CLIENT_ID42});43```44Without this, `DefaultAzureCredential` tries SystemAssigned first and fails. Add `AZURE_CLIENT_ID` as an app setting mapped to the UAMI client ID.4546## Flex Consumption Specifics4748- **Always-ready for non-HTTP triggers**: Blob trigger groups on Flex Consumption require `alwaysReady: [{ name: "blob", instanceCount: 1 }]` to bootstrap the trigger listener. Without it, the trigger group never starts and Event Grid subscriptions are never auto-created (chicken-and-egg problem)49- **Blob trigger with EventGrid source requires queue endpoint**: The blob extension internally uses queues for poison-message tracking. Must include `AzureWebJobsStorage__queueServiceUri` even when using blob trigger (not queue trigger)50- **Event Grid subscriptions via Bicep/ARM only**: Do NOT create Event Grid event subscriptions via CLI — webhook validation fails on Flex Consumption with "response code Unknown". Deploy as Bicep resources using `listKeys()` to resolve the `blobs_extension` system key at deployment time51- **azd init on non-empty directories**: `azd init --template` refuses non-empty directories. Use temp directory approach: init in temp, copy template infrastructure files back52