Chapter 10 · Azure Cloud Migrate
Subchapter 10.21
references/services/functions/code-migration.mdMarkdown6 KBView on GitHub
mcp_azure_mcp_get_azure_bestpractices tool[4.*, 5.0.0) in host.jsoninput.storageBlob() / output.storageBlob() with extraInputs/extraOutputs. For queues, use app.storageQueue() or app.serviceBusQueue(). Only use SDK when there is no equivalent binding (e.g., Azure AI, custom HTTP calls)mcp_azure_mcp_get_azure_bestpractices tool for code generation guidance<workspace-root-basename>-azure/). Do NOT create files inside the original AWS directory{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
},
"extensions": {
"queues": {
"maxPollingInterval": "00:00:02",
"visibilityTimeout": "00:00:30",
"batchSize": 1,
"maxDequeueCount": 5
}
},
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
}
}When migrating S3 event triggers to Azure blob triggers with source: 'EventGrid', the following infrastructure must be configured at the IaC level (not code level). Failure to set these up results in silent trigger failures.
| Requirement | Why | Consequence of Missing |
|---|---|---|
Queue endpoint (AzureWebJobsStorage__queueServiceUri) | Blob extension uses queues internally for poison-message tracking with EventGrid source | Function fails to index: “Unable to find matching constructor…QueueServiceClient” |
| Always-ready instances (Flex Consumption only) | Blob trigger group must be running to register the Event Grid webhook | Trigger group never starts → webhook never registered → events never delivered |
| Event Grid subscription via Bicep/ARM | CLI-based webhook validation handshake times out on Flex Consumption | Use listKeys() in Bicep to obtain the blobs_extension system key at deployment time |
| Storage Queue Data Contributor RBAC | Identity-based queue access for poison messages | 403 errors during blob trigger indexing |
See lambda-to-functions.md for Bicep patterns.
When using User Assigned Managed Identity (UAMI), DefaultAzureCredential() without arguments tries System Assigned first and fails. Always pass the client ID:
const credential = new DefaultAzureCredential({
managedIdentityClientId: process.env.AZURE_CLIENT_ID
});Add AZURE_CLIENT_ID as an app setting in Bicep pointing to the UAMI client ID.
azd init --template <template> refuses to run in a non-empty directory. Use a temp-directory approach:
azd init --template <template> in an empty temp directoryinfra/, azure.yaml, etc.) into the project root{
"dependencies": {
"@azure/functions": "^4.0.0",
"@azure/identity": "<latest>"
},
"devDependencies": {
"@azure/functions-core-tools": "^4",
"jest": "<latest>"
}
}Load the appropriate runtime reference for the target language:
| Runtime | Reference |
|---|---|
| JavaScript (Node.js v4) | runtimes/javascript.md |
| TypeScript (v4) | runtimes/typescript.md |
| Python (v2) | runtimes/python.md |
| C# (Isolated Worker) | runtimes/csharp.md |
| Java | runtimes/java.md |
| PowerShell | runtimes/powershell.md |
See lambda-to-functions.md for detailed trigger mapping, code patterns, and examples.
After code migration is complete:
migration-status.md — mark Code Migration as ✅ Completeazure.yaml and .azure/preparation-manifest.md