Skip to content

Commit 9a9da2d

Browse files
committed
feat: configure automatic DTS/Azure Storage switching and fix task hub naming
- Add app settings override for automatic environment switching * Local: uses azureStorage with AzureWebJobsStorage (via host.json) * Azure: uses azureManaged with DTS_CONNECTION_STRING (via app settings) * No manual host.json changes required between environments - Fix task hub naming convention * Remove hyphen from taskhub abbreviation (taskhub- → taskhub) * Task hub names must be alphanumeric only per Azure DTS requirements * Prevents 'Invalid table name' errors in production - Clean up environment variables * Remove DURABLE_TASK_STORAGE_TYPE from local.settings files * Remove DURABLE_TASK_CONNECTION_STRING_NAME from local.settings files * Update generate-settings scripts to exclude removed variables - Infrastructure improvements * Quote app settings keys with double underscores in bicep * Maintain Always Ready configuration for DTS with Flex Consumption * Configuration: AzureFunctionsJobHost__extensions__durableTask__storageProvider__* This implementation follows the Azure Functions app settings override pattern documented at: https://learn.microsoft.com/azure/azure-functions/functions-host-json\#override-hostjson-values
1 parent d8cb5e2 commit 9a9da2d

5 files changed

Lines changed: 7 additions & 4 deletions

File tree

infra/abbreviations.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,5 @@
133133
"webSitesFunctions": "func-",
134134
"webStaticSites": "stapp-",
135135
"dts": "dts-",
136-
"taskhub": "taskhub-"
136+
"taskhub": "taskhub"
137137
}

infra/main.bicep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ module api './app/api.bicep' = {
230230
AZURE_CLIENT_ID: apiUserAssignedIdentity.outputs.clientId
231231
DTS_CONNECTION_STRING: 'Endpoint=${dts.outputs.dts_URL};Authentication=ManagedIdentity;ClientID=${apiUserAssignedIdentity.outputs.clientId}'
232232
TASKHUB_NAME: dts.outputs.TASKHUB_NAME
233+
// Override host.json durableTask storageProvider for Azure (use DTS instead of azureStorage)
234+
'AzureFunctionsJobHost__extensions__durableTask__storageProvider__type': 'azureManaged'
235+
'AzureFunctionsJobHost__extensions__durableTask__storageProvider__connectionStringName': 'DTS_CONNECTION_STRING'
233236
}
234237
}
235238
dependsOn: [

scripts/generate-settings.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ $settingsJson = @"
2525
"AzureWebJobsSecretStorageType": "files",
2626
"FUNCTIONS_WORKER_RUNTIME": "python",
2727
"PYTHON_ENABLE_WORKER_EXTENSIONS": "True",
28-
"DTS_CONNECTION_STRING": "Endpoint=http://localhost:8080;Authentication=None",
2928
"TASKHUB_NAME": "default",
29+
"DTS_CONNECTION_STRING": "Endpoint=http://localhost:8080;Authentication=None",
3030
"COSMOS_DATABASE_NAME": "dev-snippet-db",
3131
"COSMOS_CONTAINER_NAME": "code-snippets",
3232
"BLOB_CONTAINER_NAME": "snippet-backups",

scripts/generate-settings.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ cat > src/local.settings.json << EOF
1919
"AzureWebJobsSecretStorageType": "files",
2020
"FUNCTIONS_WORKER_RUNTIME": "python",
2121
"PYTHON_ENABLE_WORKER_EXTENSIONS": "True",
22-
"DTS_CONNECTION_STRING": "Endpoint=http://localhost:8080;Authentication=None",
2322
"TASKHUB_NAME": "default",
23+
"DTS_CONNECTION_STRING": "Endpoint=http://localhost:8080;Authentication=None",
2424
"COSMOS_DATABASE_NAME": "dev-snippet-db",
2525
"COSMOS_CONTAINER_NAME": "code-snippets",
2626
"BLOB_CONTAINER_NAME": "snippet-backups",

src/local.settings.example.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
55
"FUNCTIONS_WORKER_RUNTIME": "python",
66
"PYTHON_ENABLE_WORKER_EXTENSIONS": "True",
7-
"DTS_CONNECTION_STRING": "Endpoint=http://localhost:8080;Authentication=None",
87
"TASKHUB_NAME": "default",
8+
"DTS_CONNECTION_STRING": "Endpoint=http://localhost:8080;Authentication=None",
99
"COSMOS_DATABASE_NAME": "dev-snippet-db",
1010
"COSMOS_CONTAINER_NAME": "code-snippets",
1111
"BLOB_CONTAINER_NAME": "snippet-backups",

0 commit comments

Comments
 (0)