Skip to content

Commit 6f7d6db

Browse files
committed
change API hosting to App Service and setup Deployment
1 parent cfab376 commit 6f7d6db

File tree

1 file changed

+20
-56
lines changed

1 file changed

+20
-56
lines changed

Labs/deploy/azuredeploy.bicep

Lines changed: 20 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,10 @@ var appServiceSettings = {
112112
}
113113
api: {
114114
name: '${name}-api'
115-
/*
116115
git: {
117-
repo: appGitRepository
118-
branch: appGetRepositoryBranch
116+
repo: 'https://github.com/crpietschmann/cosmos-db-dev-guide-backend-app-python.git'
117+
branch: 'main'
119118
}
120-
*/
121119
}
122120
}
123121

@@ -235,7 +233,7 @@ resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
235233

236234

237235
/* *************************************************************** */
238-
/* App Hosting - Azure App Service */
236+
/* Front-end Web App Hosting - Azure App Service */
239237
/* *************************************************************** */
240238

241239
resource appServiceWeb 'Microsoft.Web/sites@2022-03-01' = {
@@ -257,7 +255,7 @@ resource appServiceWebSettings 'Microsoft.Web/sites/config@2022-03-01' = {
257255
kind: 'string'
258256
properties: {
259257
APPINSIGHTS_INSTRUMENTATIONKEY: appServiceWebInsights.properties.InstrumentationKey
260-
API_ENDPOINT: 'https://${appServiceFunction.properties.defaultHostName}'
258+
API_ENDPOINT: 'https://${appServiceApi.properties.defaultHostName}'
261259
}
262260
}
263261

@@ -297,49 +295,28 @@ resource appServiceWebDeployment 'Microsoft.Web/sites/sourcecontrols@2021-03-01'
297295

298296

299297
/* *************************************************************** */
300-
/* API Hosting - Azure Functions */
298+
/* Back-end API Hosting - Azure App Service */
301299
/* *************************************************************** */
302300

303-
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-09-01' = {
304-
name: '${replace(toLower(appServiceSettings.api.name), '-', '')}funcst'
305-
location: location
306-
kind: 'Storage'
307-
sku: {
308-
name: 'Standard_LRS'
309-
}
310-
}
311-
312-
resource appServiceFunction 'Microsoft.Web/sites@2022-03-01' = {
313-
name: '${appServiceSettings.api.name}-func'
301+
resource appServiceApi 'Microsoft.Web/sites@2022-03-01' = {
302+
name: appServiceSettings.api.name
314303
location: location
315-
kind: 'functionapp'
316304
properties: {
317305
serverFarmId: appServicePlan.id
318306
httpsOnly: true
319307
siteConfig: {
320-
pythonVersion: '3.11'
321-
alwaysOn: true
322-
cors: {
323-
allowedOrigins: [
324-
'https://${appServiceWeb.properties.defaultHostName}'
325-
]
326-
}
308+
linuxFxVersion: 'PYTHON|3.12'
327309
}
328310
}
329-
dependsOn: [
330-
storageAccount
331-
]
332311
}
333312

334-
resource appServiceFunctionSettings 'Microsoft.Web/sites/config@2022-03-01' = {
335-
parent: appServiceFunction
313+
resource appServiceApiSettings 'Microsoft.Web/sites/config@2022-03-01' = {
314+
parent: appServiceApi
336315
name: 'appsettings'
337316
kind: 'string'
338317
properties: {
339-
AzureWebJobsStorage: 'DefaultEndpointsProtocol=https;AccountName=${name}fnstorage;EndpointSuffix=core.windows.net;AccountKey=${storageAccount.listKeys().keys[0].value}'
340-
APPLICATIONINSIGHTS_CONNECTION_STRING: appServiceFunctionsInsights.properties.ConnectionString
341-
FUNCTIONS_EXTENSION_VERSION: '~4'
342-
FUNCTIONS_WORKER_RUNTIME: 'python'
318+
ENABLE_ORYX_BUILD: 'true'
319+
SCM_DO_BUILD_DURING_DEPLOYMENT: 'true'
343320
OPENAI__ENDPOINT: openAiAccount.properties.endpoint
344321
OPENAI__KEY: openAiAccount.listKeys().key1
345322
OPENAI__EMBEDDINGSDEPLOYMENT: openAiEmbeddingsModelDeployment.name
@@ -349,8 +326,8 @@ resource appServiceFunctionSettings 'Microsoft.Web/sites/config@2022-03-01' = {
349326
}
350327
}
351328

352-
resource appServiceFunctionConnectionStrings 'Microsoft.Web/sites/config@2022-03-01' = {
353-
parent: appServiceFunction
329+
resource appServiceApiConnectionStrings 'Microsoft.Web/sites/config@2022-03-01' = {
330+
parent: appServiceApi
354331
name: 'connectionstrings'
355332
kind: 'string'
356333
properties: {
@@ -361,31 +338,18 @@ resource appServiceFunctionConnectionStrings 'Microsoft.Web/sites/config@2022-03
361338
}
362339
}
363340

364-
resource appServiceFunctionsInsights 'Microsoft.Insights/components@2020-02-02' = {
365-
name: '${appServiceSettings.api.name}-appi'
366-
location: location
367-
kind: 'web'
368-
properties: {
369-
Application_Type: 'web'
370-
}
371-
}
372-
373-
/*
374-
resource appServiceFunctionsDeployment 'Microsoft.Web/sites/sourcecontrols@2021-03-01' = {
375-
parent: appServiceFunction
341+
resource appServiceApiDeployment 'Microsoft.Web/sites/sourcecontrols@2021-03-01' = {
342+
parent: appServiceApi
376343
name: 'web'
377344
properties: {
378-
repoUrl: appServiceSettings.web.git.repo
379-
branch: appServiceSettings.web.git.branch
345+
repoUrl: appServiceSettings.api.git.repo
346+
branch: appServiceSettings.api.git.branch
380347
isManualIntegration: true
381348
}
382349
dependsOn: [
383-
appServiceFunctionSettings
350+
appServiceApiSettings
384351
]
385352
}
386-
*/
387-
388-
389353

390354

391355
/* *************************************************************** */
@@ -394,4 +358,4 @@ resource appServiceFunctionsDeployment 'Microsoft.Web/sites/sourcecontrols@2021-
394358

395359
output deployedWebUrl string = appServiceWeb.properties.defaultHostName
396360

397-
output deployedFunctionUrl string = appServiceFunction.properties.defaultHostName
361+
output deployedApiUrl string = appServiceApi.properties.defaultHostName

0 commit comments

Comments
 (0)