@@ -27,6 +27,8 @@ var package_container_name = 'packages'
27
27
// Create a container for the Python code
28
28
var python_container_name = 'python'
29
29
30
+ var storage_connection_string = 'DefaultEndpointsProtocol=https;AccountName=${storageAccount .name };EndpointSuffix=${environment ().suffixes .storage };AccountKey=${storageAccount .listKeys ().keys [0 ].value }'
31
+
30
32
// The version of Python to run with
31
33
var python_version = '3.11'
32
34
@@ -50,7 +52,7 @@ resource packageContainer 'Microsoft.Storage/storageAccounts/blobServices/contai
50
52
parent : defBlobServices
51
53
name : package_container_name
52
54
}
53
- resource pythonContainer 'Microsoft.Storage/storageAccounts/blobServices/containers@2025-01-01' existing = if (! use_shared_keys ) {
55
+ resource pythonContainer 'Microsoft.Storage/storageAccounts/blobServices/containers@2025-01-01' existing = {
54
56
parent : defBlobServices
55
57
name : python_container_name
56
58
}
@@ -108,15 +110,11 @@ var common_settings = [
108
110
var app_settings = use_shared_keys ? concat (common_settings , [
109
111
{
110
112
name : 'AzureWebJobsStorage'
111
- value : 'DefaultEndpointsProtocol=https;AccountName=${storageAccount .name };EndpointSuffix=${environment ().suffixes .storage };AccountKey=${storageAccount .listKeys ().keys [0 ].value }'
112
- }
113
- {
114
- name : 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
115
- value : 'DefaultEndpointsProtocol=https;AccountName=${storageAccount .name };EndpointSuffix=${environment ().suffixes .storage };AccountKey=${storageAccount .listKeys ().keys [0 ].value }'
113
+ value : storage_connection_string
116
114
}
117
115
{
118
- name : 'WEBSITE_CONTENTSHARE '
119
- value : toLower ( functionAppName )
116
+ name : 'DEPLOYMENT_STORAGE_CONNECTION_STRING '
117
+ value : storage_connection_string
120
118
}
121
119
]) : concat (common_settings , [
122
120
{
@@ -134,13 +132,20 @@ var function_runtime = {
134
132
version : python_version
135
133
}
136
134
135
+ var deployment_storage_value = 'https://${storageAccount .name }.blob.${environment ().suffixes .storage }/${pythonContainer .name }'
136
+
137
+ var deployment_authentication = use_shared_keys ? {
138
+ type : 'StorageAccountConnectionString'
139
+ storageAccountConnectionStringName : 'DEPLOYMENT_STORAGE_CONNECTION_STRING'
140
+ } : {
141
+ type : 'SystemAssignedIdentity'
142
+ }
143
+
137
144
var flex_deployment_configuration = {
138
145
storage : {
139
146
type : 'blobContainer'
140
- value : 'https://${storageAccount .name }.blob.${environment ().suffixes .storage }/${pythonContainer .name }'
141
- authentication : {
142
- type : 'SystemAssignedIdentity'
143
- }
147
+ value : deployment_storage_value
148
+ authentication : deployment_authentication
144
149
}
145
150
}
146
151
@@ -149,16 +154,11 @@ var flex_scale_and_concurrency = {
149
154
instanceMemoryMB : 2048
150
155
}
151
156
152
- // Define common app config
153
- var common_app_config = {
157
+ var function_app_config = {
154
158
runtime : function_runtime
155
159
scaleAndConcurrency : flex_scale_and_concurrency
156
- }
157
-
158
- // For managed identity, add the deployment configuration, otherwise just use common config
159
- var function_app_config = use_shared_keys ? common_app_config : union (common_app_config , {
160
160
deployment : flex_deployment_configuration
161
- })
161
+ }
162
162
163
163
// Create the function app.
164
164
resource functionApp 'Microsoft.Web/sites@2024-11-01' = {
0 commit comments