Azdevify eshopOnWeb
This commit is contained in:
18
infra/core/host/appservice-config-cosmos.bicep
Normal file
18
infra/core/host/appservice-config-cosmos.bicep
Normal file
@@ -0,0 +1,18 @@
|
||||
param appServiceName string
|
||||
param cosmosConnectionStringKey string = ''
|
||||
param cosmosDatabaseName string = ''
|
||||
param cosmosEndpoint string = ''
|
||||
|
||||
module appServiceConfigCosmosSettings 'appservice-config-union.bicep' = {
|
||||
name: '${appServiceName}-appservice-config-cosmos-settings'
|
||||
params: {
|
||||
appServiceName: appServiceName
|
||||
configName: 'appsettings'
|
||||
currentConfigProperties: list(resourceId('Microsoft.Web/sites/config', appServiceName, 'appsettings'), '2022-03-01').properties
|
||||
additionalConfigProperties: {
|
||||
AZURE_COSMOS_CONNECTION_STRING_KEY: cosmosConnectionStringKey
|
||||
AZURE_COSMOS_DATABASE_NAME: cosmosDatabaseName
|
||||
AZURE_COSMOS_ENDPOINT: cosmosEndpoint
|
||||
}
|
||||
}
|
||||
}
|
||||
11
infra/core/host/appservice-config-logs.bicep
Normal file
11
infra/core/host/appservice-config-logs.bicep
Normal file
@@ -0,0 +1,11 @@
|
||||
param appServiceName string
|
||||
|
||||
resource siteConfigLogs 'Microsoft.Web/sites/config@2022-03-01' = {
|
||||
name: '${appServiceName}/logs'
|
||||
properties: {
|
||||
applicationLogs: { fileSystem: { level: 'Verbose' } }
|
||||
detailedErrorMessages: { enabled: true }
|
||||
failedRequestsTracing: { enabled: true }
|
||||
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
|
||||
}
|
||||
}
|
||||
14
infra/core/host/appservice-config-sqlserver.bicep
Normal file
14
infra/core/host/appservice-config-sqlserver.bicep
Normal file
@@ -0,0 +1,14 @@
|
||||
param appServiceName string
|
||||
param sqlConnectionStringKey string
|
||||
|
||||
module appServiceConfigSqlServerSettings 'appservice-config-union.bicep' = {
|
||||
name: '${appServiceName}-appservice-config-sqlserver-settings'
|
||||
params: {
|
||||
appServiceName: appServiceName
|
||||
configName: 'appsettings'
|
||||
currentConfigProperties: list(resourceId('Microsoft.Web/sites/config', appServiceName, 'appsettings'), '2022-03-01').properties
|
||||
additionalConfigProperties: {
|
||||
AZURE_SQL_CONNECTION_STRING_KEY: sqlConnectionStringKey
|
||||
}
|
||||
}
|
||||
}
|
||||
9
infra/core/host/appservice-config-union.bicep
Normal file
9
infra/core/host/appservice-config-union.bicep
Normal file
@@ -0,0 +1,9 @@
|
||||
param additionalConfigProperties object
|
||||
param appServiceName string
|
||||
param configName string
|
||||
param currentConfigProperties object
|
||||
|
||||
resource siteConfigUnion 'Microsoft.Web/sites/config@2022-03-01' = {
|
||||
name: '${appServiceName}/${configName}'
|
||||
properties: union(currentConfigProperties, additionalConfigProperties)
|
||||
}
|
||||
35
infra/core/host/appservice-dotnet.bicep
Normal file
35
infra/core/host/appservice-dotnet.bicep
Normal file
@@ -0,0 +1,35 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param allowedOrigins array = []
|
||||
param appCommandLine string = ''
|
||||
param applicationInsightsName string = ''
|
||||
param appServicePlanId string
|
||||
param appSettings object = {}
|
||||
param keyVaultName string = ''
|
||||
param linuxFxVersion string = 'DOTNETCORE|6.0'
|
||||
param managedIdentity bool = !(empty(keyVaultName))
|
||||
param scmDoBuildDuringDeployment bool = false
|
||||
param serviceName string
|
||||
|
||||
module appService 'appservice.bicep' = {
|
||||
name: '${serviceName}-appservice-dotnet'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
allowedOrigins: allowedOrigins
|
||||
appCommandLine: appCommandLine
|
||||
applicationInsightsName: applicationInsightsName
|
||||
appServicePlanId: appServicePlanId
|
||||
appSettings: appSettings
|
||||
keyVaultName: keyVaultName
|
||||
linuxFxVersion: linuxFxVersion
|
||||
managedIdentity: managedIdentity
|
||||
scmDoBuildDuringDeployment: scmDoBuildDuringDeployment
|
||||
serviceName: serviceName
|
||||
}
|
||||
}
|
||||
|
||||
output identityPrincipalId string = appService.outputs.identityPrincipalId
|
||||
output name string = appService.outputs.name
|
||||
output uri string = appService.outputs.uri
|
||||
35
infra/core/host/appservice-node.bicep
Normal file
35
infra/core/host/appservice-node.bicep
Normal file
@@ -0,0 +1,35 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param allowedOrigins array = []
|
||||
param appCommandLine string = ''
|
||||
param applicationInsightsName string = ''
|
||||
param appServicePlanId string
|
||||
param appSettings object = {}
|
||||
param keyVaultName string = ''
|
||||
param linuxFxVersion string = 'NODE|16-lts'
|
||||
param managedIdentity bool = !(empty(keyVaultName))
|
||||
param scmDoBuildDuringDeployment bool = false
|
||||
param serviceName string
|
||||
|
||||
module appService 'appservice.bicep' = {
|
||||
name: '${serviceName}-appservice-node'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
allowedOrigins: allowedOrigins
|
||||
appCommandLine: appCommandLine
|
||||
applicationInsightsName: applicationInsightsName
|
||||
appServicePlanId: appServicePlanId
|
||||
appSettings: appSettings
|
||||
keyVaultName: keyVaultName
|
||||
linuxFxVersion: linuxFxVersion
|
||||
managedIdentity: managedIdentity
|
||||
scmDoBuildDuringDeployment: scmDoBuildDuringDeployment
|
||||
serviceName: serviceName
|
||||
}
|
||||
}
|
||||
|
||||
output identityPrincipalId string = appService.outputs.identityPrincipalId
|
||||
output name string = appService.outputs.name
|
||||
output uri string = appService.outputs.uri
|
||||
35
infra/core/host/appservice-python.bicep
Normal file
35
infra/core/host/appservice-python.bicep
Normal file
@@ -0,0 +1,35 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param allowedOrigins array = []
|
||||
param appCommandLine string = ''
|
||||
param applicationInsightsName string = ''
|
||||
param appServicePlanId string
|
||||
param appSettings object = {}
|
||||
param keyVaultName string = ''
|
||||
param linuxFxVersion string = 'PYTHON|3.8'
|
||||
param managedIdentity bool = !(empty(keyVaultName))
|
||||
param scmDoBuildDuringDeployment bool = true
|
||||
param serviceName string
|
||||
|
||||
module appService 'appservice.bicep' = {
|
||||
name: '${serviceName}-appservice-python'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
allowedOrigins: allowedOrigins
|
||||
appCommandLine: appCommandLine
|
||||
applicationInsightsName: applicationInsightsName
|
||||
appServicePlanId: appServicePlanId
|
||||
appSettings: appSettings
|
||||
keyVaultName: keyVaultName
|
||||
linuxFxVersion: linuxFxVersion
|
||||
managedIdentity: managedIdentity
|
||||
scmDoBuildDuringDeployment: scmDoBuildDuringDeployment
|
||||
serviceName: serviceName
|
||||
}
|
||||
}
|
||||
|
||||
output identityPrincipalId string = appService.outputs.identityPrincipalId
|
||||
output name string = appService.outputs.name
|
||||
output uri string = appService.outputs.uri
|
||||
100
infra/core/host/appservice.bicep
Normal file
100
infra/core/host/appservice.bicep
Normal file
@@ -0,0 +1,100 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param allowedOrigins array = []
|
||||
param alwaysOn bool = true
|
||||
param appCommandLine string = ''
|
||||
param applicationInsightsName string = ''
|
||||
param appServicePlanId string
|
||||
param appSettings object = {}
|
||||
param clientAffinityEnabled bool = false
|
||||
param functionAppScaleLimit int = -1
|
||||
param keyVaultName string = ''
|
||||
param kind string = 'app,linux'
|
||||
param linuxFxVersion string = ''
|
||||
param managedIdentity bool = !(empty(keyVaultName))
|
||||
param minimumElasticInstanceCount int = -1
|
||||
param numberOfWorkers int = -1
|
||||
param scmDoBuildDuringDeployment bool = false
|
||||
param serviceName string
|
||||
param use32BitWorkerProcess bool = false
|
||||
|
||||
var abbrs = loadJsonContent('../../abbreviations.json')
|
||||
var tags = { 'azd-env-name': environmentName }
|
||||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
|
||||
|
||||
var prefix = contains(kind, 'function') ? abbrs.webSitesFunctions : abbrs.webSitesAppService
|
||||
|
||||
resource appService 'Microsoft.Web/sites@2022-03-01' = {
|
||||
name: '${prefix}${serviceName}-${resourceToken}'
|
||||
location: location
|
||||
tags: union(tags, { 'azd-service-name': serviceName })
|
||||
kind: kind
|
||||
properties: {
|
||||
serverFarmId: appServicePlanId
|
||||
siteConfig: {
|
||||
linuxFxVersion: linuxFxVersion
|
||||
alwaysOn: alwaysOn
|
||||
ftpsState: 'FtpsOnly'
|
||||
appCommandLine: appCommandLine
|
||||
numberOfWorkers: numberOfWorkers != -1 ? numberOfWorkers : null
|
||||
minimumElasticInstanceCount: minimumElasticInstanceCount != -1 ? minimumElasticInstanceCount : null
|
||||
use32BitWorkerProcess: use32BitWorkerProcess
|
||||
functionAppScaleLimit: functionAppScaleLimit != -1 ? functionAppScaleLimit : null
|
||||
cors: {
|
||||
allowedOrigins: union([ 'https://portal.azure.com', 'https://ms.portal.azure.com' ], allowedOrigins)
|
||||
}
|
||||
}
|
||||
clientAffinityEnabled: clientAffinityEnabled
|
||||
httpsOnly: true
|
||||
}
|
||||
|
||||
identity: managedIdentity ? { type: 'SystemAssigned' } : null
|
||||
|
||||
resource appSettings 'config' = {
|
||||
name: 'appsettings'
|
||||
properties: union({
|
||||
SCM_DO_BUILD_DURING_DEPLOYMENT: string(scmDoBuildDuringDeployment)
|
||||
},
|
||||
!(empty(applicationInsightsName)) ? { APPLICATIONINSIGHTS_CONNECTION_STRING: applicationInsights.properties.ConnectionString } : {},
|
||||
!(empty(keyVaultName)) ? { AZURE_KEY_VAULT_ENDPOINT: keyVault.properties.vaultUri } : {})
|
||||
}
|
||||
}
|
||||
|
||||
module appSettingsUnion 'appservice-config-union.bicep' = if (!empty(appSettings)) {
|
||||
name: '${serviceName}-app-settings-union'
|
||||
params: {
|
||||
appServiceName: appService.name
|
||||
configName: 'appsettings'
|
||||
currentConfigProperties: appService::appSettings.list().properties
|
||||
additionalConfigProperties: appSettings
|
||||
}
|
||||
}
|
||||
|
||||
module siteConfigLogs 'appservice-config-logs.bicep' = {
|
||||
name: '${serviceName}-appservice-config-logs'
|
||||
params: {
|
||||
appServiceName: appService.name
|
||||
}
|
||||
}
|
||||
|
||||
module keyVaultAccess '../security/keyvault-access.bicep' = if (!(empty(keyVaultName))) {
|
||||
name: '${serviceName}-appservice-keyvault-access'
|
||||
params: {
|
||||
principalId: appService.identity.principalId
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
}
|
||||
}
|
||||
|
||||
resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = if (!(empty(keyVaultName))) {
|
||||
name: keyVaultName
|
||||
}
|
||||
|
||||
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing = if (!(empty(applicationInsightsName))) {
|
||||
name: applicationInsightsName
|
||||
}
|
||||
|
||||
output identityPrincipalId string = managedIdentity ? appService.identity.principalId : ''
|
||||
output name string = appService.name
|
||||
output uri string = 'https://${appService.properties.defaultHostName}'
|
||||
21
infra/core/host/appserviceplan-functions.bicep
Normal file
21
infra/core/host/appserviceplan-functions.bicep
Normal file
@@ -0,0 +1,21 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param sku object = {
|
||||
name: 'Y1'
|
||||
tier: 'Dynamic'
|
||||
size: 'Y1'
|
||||
family: 'Y'
|
||||
}
|
||||
|
||||
module appServicePlanFunctions 'appserviceplan.bicep' = {
|
||||
name: 'appserviceplan-functions'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
sku: sku
|
||||
kind: 'functionapp'
|
||||
}
|
||||
}
|
||||
|
||||
output appServicePlanId string = appServicePlanFunctions.outputs.appServicePlanId
|
||||
15
infra/core/host/appserviceplan-sites.bicep
Normal file
15
infra/core/host/appserviceplan-sites.bicep
Normal file
@@ -0,0 +1,15 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param sku object = { name: 'B1' }
|
||||
|
||||
module appServicePlanSites 'appserviceplan.bicep' = {
|
||||
name: 'appserviceplan-sites'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
sku: sku
|
||||
}
|
||||
}
|
||||
|
||||
output appServicePlanId string = appServicePlanSites.outputs.appServicePlanId
|
||||
23
infra/core/host/appserviceplan.bicep
Normal file
23
infra/core/host/appserviceplan.bicep
Normal file
@@ -0,0 +1,23 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param kind string = ''
|
||||
param reserved bool = true
|
||||
param sku object
|
||||
|
||||
var abbrs = loadJsonContent('../../abbreviations.json')
|
||||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
|
||||
var tags = { 'azd-env-name': environmentName }
|
||||
|
||||
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
|
||||
name: '${abbrs.webServerFarms}${resourceToken}'
|
||||
location: location
|
||||
tags: tags
|
||||
sku: sku
|
||||
kind: kind
|
||||
properties: {
|
||||
reserved: reserved
|
||||
}
|
||||
}
|
||||
|
||||
output appServicePlanId string = appServicePlan.id
|
||||
79
infra/core/host/container-app.bicep
Normal file
79
infra/core/host/container-app.bicep
Normal file
@@ -0,0 +1,79 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param containerAppsEnvironmentName string = ''
|
||||
param containerRegistryName string = ''
|
||||
param env array = []
|
||||
param external bool = true
|
||||
param imageName string
|
||||
param keyVaultName string = ''
|
||||
param managedIdentity bool = !(empty(keyVaultName))
|
||||
param targetPort int = 80
|
||||
param serviceName string
|
||||
|
||||
var abbrs = loadJsonContent('../../abbreviations.json')
|
||||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
|
||||
var tags = { 'azd-env-name': environmentName }
|
||||
|
||||
resource app 'Microsoft.App/containerApps@2022-03-01' = {
|
||||
name: '${abbrs.appContainerApps}${serviceName}-${resourceToken}'
|
||||
location: location
|
||||
tags: union(tags, { 'azd-service-name': serviceName })
|
||||
identity: managedIdentity ? { type: 'SystemAssigned' } : null
|
||||
properties: {
|
||||
managedEnvironmentId: containerAppsEnvironment.id
|
||||
configuration: {
|
||||
activeRevisionsMode: 'single'
|
||||
ingress: {
|
||||
external: external
|
||||
targetPort: targetPort
|
||||
transport: 'auto'
|
||||
}
|
||||
secrets: [
|
||||
{
|
||||
name: 'registry-password'
|
||||
value: containerRegistry.listCredentials().passwords[0].value
|
||||
}
|
||||
]
|
||||
registries: [
|
||||
{
|
||||
server: '${containerRegistry.name}.azurecr.io'
|
||||
username: containerRegistry.name
|
||||
passwordSecretRef: 'registry-password'
|
||||
}
|
||||
]
|
||||
}
|
||||
template: {
|
||||
containers: [
|
||||
{
|
||||
image: imageName
|
||||
name: 'main'
|
||||
env: env
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module keyVaultAccess '../security/keyvault-access.bicep' = if (!(empty(keyVaultName))) {
|
||||
name: '${serviceName}-appservice-keyvault-access'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
keyVaultName: keyVaultName
|
||||
principalId: app.identity.principalId
|
||||
}
|
||||
}
|
||||
|
||||
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2022-03-01' existing = {
|
||||
name: !empty(containerAppsEnvironmentName) ? containerAppsEnvironmentName : '${abbrs.appManagedEnvironments}${resourceToken}'
|
||||
}
|
||||
|
||||
// 2022-02-01-preview needed for anonymousPullEnabled
|
||||
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2022-02-01-preview' existing = {
|
||||
name: !empty(containerRegistryName) ? containerRegistryName : '${abbrs.containerRegistryRegistries}${resourceToken}'
|
||||
}
|
||||
|
||||
output identityPrincipalId string = managedIdentity ? app.identity.principalId : ''
|
||||
output name string = app.name
|
||||
output uri string = 'https://${app.properties.configuration.ingress.fqdn}'
|
||||
30
infra/core/host/container-apps-environment.bicep
Normal file
30
infra/core/host/container-apps-environment.bicep
Normal file
@@ -0,0 +1,30 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param containerAppsEnvironmentName string = ''
|
||||
param logAnalyticsWorkspaceName string
|
||||
|
||||
var abbrs = loadJsonContent('../../abbreviations.json')
|
||||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
|
||||
var tags = { 'azd-env-name': environmentName }
|
||||
|
||||
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2022-03-01' = {
|
||||
name: !empty(containerAppsEnvironmentName) ? containerAppsEnvironmentName : '${abbrs.appManagedEnvironments}${resourceToken}'
|
||||
location: location
|
||||
tags: tags
|
||||
properties: {
|
||||
appLogsConfiguration: {
|
||||
destination: 'log-analytics'
|
||||
logAnalyticsConfiguration: {
|
||||
customerId: logAnalyticsWorkspace.properties.customerId
|
||||
sharedKey: logAnalyticsWorkspace.listKeys().primarySharedKey
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2021-12-01-preview' existing = {
|
||||
name: logAnalyticsWorkspaceName
|
||||
}
|
||||
|
||||
output containerAppsEnvironmentName string = containerAppsEnvironment.name
|
||||
30
infra/core/host/container-apps.bicep
Normal file
30
infra/core/host/container-apps.bicep
Normal file
@@ -0,0 +1,30 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param containerAppsEnvironmentName string = ''
|
||||
param containerAppsGroupName string = 'app'
|
||||
param containerRegistryName string = ''
|
||||
param logAnalyticsWorkspaceName string = ''
|
||||
|
||||
module containerAppsEnvironment 'container-apps-environment.bicep' = {
|
||||
name: '${containerAppsGroupName}-container-apps-environment'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
containerAppsEnvironmentName: containerAppsEnvironmentName
|
||||
logAnalyticsWorkspaceName: logAnalyticsWorkspaceName
|
||||
}
|
||||
}
|
||||
|
||||
module containerRegistry 'container-registry.bicep' = {
|
||||
name: '${containerAppsGroupName}-container-registry'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
containerRegistryName: containerRegistryName
|
||||
}
|
||||
}
|
||||
|
||||
output containerAppsEnvironmentName string = containerAppsEnvironment.outputs.containerAppsEnvironmentName
|
||||
output containerRegistryEndpoint string = containerRegistry.outputs.containerRegistryEndpoint
|
||||
output containerRegistryName string = containerRegistry.outputs.containerRegistryName
|
||||
40
infra/core/host/container-registry.bicep
Normal file
40
infra/core/host/container-registry.bicep
Normal file
@@ -0,0 +1,40 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param adminUserEnabled bool = true
|
||||
param anonymousPullEnabled bool = false
|
||||
param containerRegistryName string = ''
|
||||
param dataEndpointEnabled bool = false
|
||||
param encryption object = {
|
||||
status: 'disabled'
|
||||
}
|
||||
param networkRuleBypassOptions string = 'AzureServices'
|
||||
param publicNetworkAccess string = 'Enabled'
|
||||
param sku object = {
|
||||
name: 'Standard'
|
||||
}
|
||||
param zoneRedundancy string = 'Disabled'
|
||||
|
||||
var abbrs = loadJsonContent('../../abbreviations.json')
|
||||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
|
||||
var tags = { 'azd-env-name': environmentName }
|
||||
|
||||
// 2022-02-01-preview needed for anonymousPullEnabled
|
||||
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2022-02-01-preview' = {
|
||||
name: !empty(containerRegistryName) ? containerRegistryName : '${abbrs.containerRegistryRegistries}${resourceToken}'
|
||||
location: location
|
||||
tags: tags
|
||||
sku: sku
|
||||
properties: {
|
||||
adminUserEnabled: adminUserEnabled
|
||||
anonymousPullEnabled: anonymousPullEnabled
|
||||
dataEndpointEnabled: dataEndpointEnabled
|
||||
encryption: encryption
|
||||
networkRuleBypassOptions: networkRuleBypassOptions
|
||||
publicNetworkAccess: publicNetworkAccess
|
||||
zoneRedundancy: zoneRedundancy
|
||||
}
|
||||
}
|
||||
|
||||
output containerRegistryEndpoint string = containerRegistry.properties.loginServer
|
||||
output containerRegistryName string = containerRegistry.name
|
||||
34
infra/core/host/functions-node.bicep
Normal file
34
infra/core/host/functions-node.bicep
Normal file
@@ -0,0 +1,34 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param allowedOrigins array = []
|
||||
param applicationInsightsName string = ''
|
||||
param appServicePlanId string
|
||||
param appSettings object = {}
|
||||
param keyVaultName string = ''
|
||||
param linuxFxVersion string = 'NODE|16'
|
||||
param managedIdentity bool = !(empty(keyVaultName))
|
||||
param serviceName string
|
||||
param storageAccountName string
|
||||
|
||||
module functions 'functions.bicep' = {
|
||||
name: '${serviceName}-functions-node'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
allowedOrigins: allowedOrigins
|
||||
applicationInsightsName: applicationInsightsName
|
||||
appServicePlanId: appServicePlanId
|
||||
appSettings: appSettings
|
||||
functionsWorkerRuntime: 'node'
|
||||
keyVaultName: keyVaultName
|
||||
linuxFxVersion: linuxFxVersion
|
||||
managedIdentity: managedIdentity
|
||||
serviceName: serviceName
|
||||
storageAccountName: storageAccountName
|
||||
}
|
||||
}
|
||||
|
||||
output identityPrincipalId string = functions.outputs.identityPrincipalId
|
||||
output name string = functions.outputs.name
|
||||
output uri string = functions.outputs.uri
|
||||
34
infra/core/host/functions-python.bicep
Normal file
34
infra/core/host/functions-python.bicep
Normal file
@@ -0,0 +1,34 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param allowedOrigins array = []
|
||||
param applicationInsightsName string = ''
|
||||
param appServicePlanId string
|
||||
param appSettings object = {}
|
||||
param keyVaultName string = ''
|
||||
param linuxFxVersion string = 'PYTHON|3.8'
|
||||
param managedIdentity bool = !(empty(keyVaultName))
|
||||
param serviceName string
|
||||
param storageAccountName string
|
||||
|
||||
module functions 'functions.bicep' = {
|
||||
name: '${serviceName}-functions-python'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
allowedOrigins: allowedOrigins
|
||||
applicationInsightsName: applicationInsightsName
|
||||
appServicePlanId: appServicePlanId
|
||||
appSettings: appSettings
|
||||
functionsWorkerRuntime: 'python'
|
||||
keyVaultName: keyVaultName
|
||||
linuxFxVersion: linuxFxVersion
|
||||
managedIdentity: managedIdentity
|
||||
serviceName: serviceName
|
||||
storageAccountName: storageAccountName
|
||||
}
|
||||
}
|
||||
|
||||
output identityPrincipalId string = functions.outputs.identityPrincipalId
|
||||
output name string = functions.outputs.name
|
||||
output uri string = functions.outputs.uri
|
||||
58
infra/core/host/functions.bicep
Normal file
58
infra/core/host/functions.bicep
Normal file
@@ -0,0 +1,58 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param allowedOrigins array = []
|
||||
param alwaysOn bool = false
|
||||
param applicationInsightsName string = ''
|
||||
param appServicePlanId string
|
||||
param appSettings object = {}
|
||||
param clientAffinityEnabled bool = false
|
||||
param functionAppScaleLimit int = 200
|
||||
param functionsExtensionVersion string = '~4'
|
||||
param functionsWorkerRuntime string
|
||||
param kind string = 'functionapp,linux'
|
||||
param linuxFxVersion string = ''
|
||||
param keyVaultName string = ''
|
||||
param managedIdentity bool = !(empty(keyVaultName))
|
||||
param minimumElasticInstanceCount int = 0
|
||||
param numberOfWorkers int = 1
|
||||
param scmDoBuildDuringDeployment bool = true
|
||||
param serviceName string
|
||||
param storageAccountName string
|
||||
param use32BitWorkerProcess bool = false
|
||||
|
||||
module functions 'appservice.bicep' = {
|
||||
name: '${serviceName}-functions'
|
||||
params: {
|
||||
environmentName: environmentName
|
||||
location: location
|
||||
allowedOrigins: allowedOrigins
|
||||
alwaysOn: alwaysOn
|
||||
applicationInsightsName: applicationInsightsName
|
||||
appServicePlanId: appServicePlanId
|
||||
appSettings: union(appSettings, {
|
||||
AzureWebJobsStorage: 'DefaultEndpointsProtocol=https;AccountName=${storage.name};AccountKey=${storage.listKeys().keys[0].value};EndpointSuffix=${environment().suffixes.storage}'
|
||||
FUNCTIONS_EXTENSION_VERSION: functionsExtensionVersion
|
||||
FUNCTIONS_WORKER_RUNTIME: functionsWorkerRuntime
|
||||
})
|
||||
clientAffinityEnabled: clientAffinityEnabled
|
||||
functionAppScaleLimit: functionAppScaleLimit
|
||||
keyVaultName: keyVaultName
|
||||
kind: kind
|
||||
linuxFxVersion: linuxFxVersion
|
||||
managedIdentity: managedIdentity
|
||||
minimumElasticInstanceCount: minimumElasticInstanceCount
|
||||
numberOfWorkers: numberOfWorkers
|
||||
scmDoBuildDuringDeployment: scmDoBuildDuringDeployment
|
||||
serviceName: serviceName
|
||||
use32BitWorkerProcess: use32BitWorkerProcess
|
||||
}
|
||||
}
|
||||
|
||||
resource storage 'Microsoft.Storage/storageAccounts@2021-09-01' existing = {
|
||||
name: storageAccountName
|
||||
}
|
||||
|
||||
output identityPrincipalId string = managedIdentity ? functions.outputs.identityPrincipalId : ''
|
||||
output name string = functions.outputs.name
|
||||
output uri string = functions.outputs.uri
|
||||
25
infra/core/host/staticwebapp.bicep
Normal file
25
infra/core/host/staticwebapp.bicep
Normal file
@@ -0,0 +1,25 @@
|
||||
param environmentName string
|
||||
param location string = resourceGroup().location
|
||||
|
||||
param serviceName string
|
||||
param sku object = {
|
||||
name: 'Free'
|
||||
tier: 'Free'
|
||||
}
|
||||
|
||||
var abbrs = loadJsonContent('../../abbreviations.json')
|
||||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
|
||||
var tags = { 'azd-env-name': environmentName }
|
||||
|
||||
resource web 'Microsoft.Web/staticSites@2022-03-01' = {
|
||||
name: '${abbrs.webStaticSites}${serviceName}-${resourceToken}'
|
||||
location: location
|
||||
tags: union(tags, { 'azd-service-name': serviceName })
|
||||
sku: sku
|
||||
properties: {
|
||||
provider: 'Custom'
|
||||
}
|
||||
}
|
||||
|
||||
output name string = web.name
|
||||
output uri string = 'https://${web.properties.defaultHostname}'
|
||||
Reference in New Issue
Block a user