/
deploy-functionsapp.bicep
75 lines (61 loc) · 2.6 KB
/
deploy-functionsapp.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//====================================================================================
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//====================================================================================
//
// Developed by Dr. Gaiye "Gail" Zhou, Sr Architect @ Microsoft.
// August 2022
//
//====================================================================================
//targetScope = 'subscription'
targetScope = 'resourceGroup'
param location string
param resourceGroupName string
param keyVaultName string
param midName string
param azureFunctionsAppName string
var funAppStorageName = '${azureFunctionsAppName}storage'
//====================================================================================
// Resource Group and KeyVault Policy Set up
// Azure Functions App (Infrastructure only) with below resources
// Hosting Plan
// Azure Functions App
// Azure Functions Code ---- This needs to be manually deployed from VSD
//====================================================================================
// Resource Group already created
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' existing = {
name: resourceGroupName
scope:subscription()
}
//====================================================================================
// Create Azure Functions and ASP
// After creation, there is another step to deploy code to the Azure Functions
//====================================================================================
resource formKeyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = {
name: keyVaultName
scope:resourceGroup
}
resource userAssignedMid 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' existing = {
name: midName
scope:resourceGroup
}
module azureFunctionsApp 'azure-functionsapp.bicep' = {
name: 'module-azure-functionsapp'
scope: resourceGroup
params:{
midName:midName
location:location
funAppStorageName:funAppStorageName
midClientId:userAssignedMid.properties.clientId
azureFunctionsAppName:azureFunctionsAppName
paramFormRecognizerEndPoint:formKeyVault.getSecret('FormRecognizerEndPoint')
paramFormRecognizerKey:formKeyVault.getSecret('FormRecognizerKey')
keyVaultName:keyVaultName
}
}
// output from this module
output azureFunctionsAppName string = azureFunctionsAppName
output funAppStorageName string = funAppStorageName
// output from the called module
output serverFarmName string = azureFunctionsApp.outputs.serverFarmName
output appInsightsName string = azureFunctionsApp.outputs.appInsightsName