@@ -27,6 +27,8 @@ var package_container_name = 'packages'
2727// Create a container for the Python code
2828var python_container_name = 'python'
2929
30+ var storage_connection_string = 'DefaultEndpointsProtocol=https;AccountName=${storageAccount .name };EndpointSuffix=${environment ().suffixes .storage };AccountKey=${storageAccount .listKeys ().keys [0 ].value }'
31+
3032// The version of Python to run with
3133var python_version = '3.11'
3234
@@ -50,7 +52,7 @@ resource packageContainer 'Microsoft.Storage/storageAccounts/blobServices/contai
5052 parent : defBlobServices
5153 name : package_container_name
5254}
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 = {
5456 parent : defBlobServices
5557 name : python_container_name
5658}
@@ -108,15 +110,11 @@ var common_settings = [
108110var app_settings = use_shared_keys ? concat (common_settings , [
109111 {
110112 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
116114 }
117115 {
118- name : 'WEBSITE_CONTENTSHARE '
119- value : toLower ( functionAppName )
116+ name : 'DEPLOYMENT_STORAGE_CONNECTION_STRING '
117+ value : storage_connection_string
120118 }
121119]) : concat (common_settings , [
122120 {
@@ -134,13 +132,20 @@ var function_runtime = {
134132 version : python_version
135133}
136134
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+
137144var flex_deployment_configuration = {
138145 storage : {
139146 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
144149 }
145150}
146151
@@ -149,16 +154,11 @@ var flex_scale_and_concurrency = {
149154 instanceMemoryMB : 2048
150155}
151156
152- // Define common app config
153- var common_app_config = {
157+ var function_app_config = {
154158 runtime : function_runtime
155159 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 , {
160160 deployment : flex_deployment_configuration
161- })
161+ }
162162
163163// Create the function app.
164164resource functionApp 'Microsoft.Web/sites@2024-11-01' = {
0 commit comments