Skip to content

Commit 751c46c

Browse files
committed
add azd files
1 parent cd7156a commit 751c46c

7 files changed

+416
-0
lines changed

azure.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
2+
3+
# This is an example starter azure.yaml file containing several example services in comments below.
4+
# Make changes as needed to describe your application setup.
5+
# To learn more about the azure.yaml file, visit https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/azd-schema
6+
7+
# Name of the application.
8+
name: msdocs-python-flask-webapp-quickstart
9+
metadata:
10+
11+
services:
12+
web:
13+
project: .
14+
language: python
15+
host: appservice

infra/abbreviations.json

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
{
2+
"analysisServicesServers": "as",
3+
"apiManagementService": "apim-",
4+
"appConfigurationConfigurationStores": "appcs-",
5+
"appManagedEnvironments": "cae-",
6+
"appContainerApps": "ca-",
7+
"authorizationPolicyDefinitions": "policy-",
8+
"automationAutomationAccounts": "aa-",
9+
"blueprintBlueprints": "bp-",
10+
"blueprintBlueprintsArtifacts": "bpa-",
11+
"cacheRedis": "redis-",
12+
"cdnProfiles": "cdnp-",
13+
"cdnProfilesEndpoints": "cdne-",
14+
"cognitiveServicesAccounts": "cog-",
15+
"cognitiveServicesFormRecognizer": "cog-fr-",
16+
"cognitiveServicesTextAnalytics": "cog-ta-",
17+
"computeAvailabilitySets": "avail-",
18+
"computeCloudServices": "cld-",
19+
"computeDiskEncryptionSets": "des",
20+
"computeDisks": "disk",
21+
"computeDisksOs": "osdisk",
22+
"computeGalleries": "gal",
23+
"computeSnapshots": "snap-",
24+
"computeVirtualMachines": "vm",
25+
"computeVirtualMachineScaleSets": "vmss-",
26+
"containerInstanceContainerGroups": "ci",
27+
"containerRegistryRegistries": "cr",
28+
"containerServiceManagedClusters": "aks-",
29+
"databricksWorkspaces": "dbw-",
30+
"dataFactoryFactories": "adf-",
31+
"dataLakeAnalyticsAccounts": "dla",
32+
"dataLakeStoreAccounts": "dls",
33+
"dataMigrationServices": "dms-",
34+
"dBforMySQLServers": "mysql-",
35+
"dBforPostgreSQLServers": "psql-",
36+
"devicesIotHubs": "iot-",
37+
"devicesProvisioningServices": "provs-",
38+
"devicesProvisioningServicesCertificates": "pcert-",
39+
"documentDBDatabaseAccounts": "cosmos-",
40+
"eventGridDomains": "evgd-",
41+
"eventGridDomainsTopics": "evgt-",
42+
"eventGridEventSubscriptions": "evgs-",
43+
"eventHubNamespaces": "evhns-",
44+
"eventHubNamespacesEventHubs": "evh-",
45+
"hdInsightClustersHadoop": "hadoop-",
46+
"hdInsightClustersHbase": "hbase-",
47+
"hdInsightClustersKafka": "kafka-",
48+
"hdInsightClustersMl": "mls-",
49+
"hdInsightClustersSpark": "spark-",
50+
"hdInsightClustersStorm": "storm-",
51+
"hybridComputeMachines": "arcs-",
52+
"insightsActionGroups": "ag-",
53+
"insightsComponents": "appi-",
54+
"keyVaultVaults": "kv-",
55+
"kubernetesConnectedClusters": "arck",
56+
"kustoClusters": "dec",
57+
"kustoClustersDatabases": "dedb",
58+
"loadTesting": "lt-",
59+
"logicIntegrationAccounts": "ia-",
60+
"logicWorkflows": "logic-",
61+
"machineLearningServicesWorkspaces": "mlw-",
62+
"managedIdentityUserAssignedIdentities": "id-",
63+
"managementManagementGroups": "mg-",
64+
"migrateAssessmentProjects": "migr-",
65+
"networkApplicationGateways": "agw-",
66+
"networkApplicationSecurityGroups": "asg-",
67+
"networkAzureFirewalls": "afw-",
68+
"networkBastionHosts": "bas-",
69+
"networkConnections": "con-",
70+
"networkDnsZones": "dnsz-",
71+
"networkExpressRouteCircuits": "erc-",
72+
"networkFirewallPolicies": "afwp-",
73+
"networkFirewallPoliciesWebApplication": "waf",
74+
"networkFirewallPoliciesRuleGroups": "wafrg",
75+
"networkFrontDoors": "fd-",
76+
"networkFrontdoorWebApplicationFirewallPolicies": "fdfp-",
77+
"networkLoadBalancersExternal": "lbe-",
78+
"networkLoadBalancersInternal": "lbi-",
79+
"networkLoadBalancersInboundNatRules": "rule-",
80+
"networkLocalNetworkGateways": "lgw-",
81+
"networkNatGateways": "ng-",
82+
"networkNetworkInterfaces": "nic-",
83+
"networkNetworkSecurityGroups": "nsg-",
84+
"networkNetworkSecurityGroupsSecurityRules": "nsgsr-",
85+
"networkNetworkWatchers": "nw-",
86+
"networkPrivateDnsZones": "pdnsz-",
87+
"networkPrivateLinkServices": "pl-",
88+
"networkPublicIPAddresses": "pip-",
89+
"networkPublicIPPrefixes": "ippre-",
90+
"networkRouteFilters": "rf-",
91+
"networkRouteTables": "rt-",
92+
"networkRouteTablesRoutes": "udr-",
93+
"networkTrafficManagerProfiles": "traf-",
94+
"networkVirtualNetworkGateways": "vgw-",
95+
"networkVirtualNetworks": "vnet-",
96+
"networkVirtualNetworksSubnets": "snet-",
97+
"networkVirtualNetworksVirtualNetworkPeerings": "peer-",
98+
"networkVirtualWans": "vwan-",
99+
"networkVpnGateways": "vpng-",
100+
"networkVpnGatewaysVpnConnections": "vcn-",
101+
"networkVpnGatewaysVpnSites": "vst-",
102+
"notificationHubsNamespaces": "ntfns-",
103+
"notificationHubsNamespacesNotificationHubs": "ntf-",
104+
"operationalInsightsWorkspaces": "log-",
105+
"portalDashboards": "dash-",
106+
"powerBIDedicatedCapacities": "pbi-",
107+
"purviewAccounts": "pview-",
108+
"recoveryServicesVaults": "rsv-",
109+
"resourcesResourceGroups": "rg-",
110+
"searchSearchServices": "srch-",
111+
"serviceBusNamespaces": "sb-",
112+
"serviceBusNamespacesQueues": "sbq-",
113+
"serviceBusNamespacesTopics": "sbt-",
114+
"serviceEndPointPolicies": "se-",
115+
"serviceFabricClusters": "sf-",
116+
"signalRServiceSignalR": "sigr",
117+
"sqlManagedInstances": "sqlmi-",
118+
"sqlServers": "sql-",
119+
"sqlServersDataWarehouse": "sqldw-",
120+
"sqlServersDatabases": "sqldb-",
121+
"sqlServersDatabasesStretch": "sqlstrdb-",
122+
"storageStorageAccounts": "st",
123+
"storageStorageAccountsVm": "stvm",
124+
"storSimpleManagers": "ssimp",
125+
"streamAnalyticsCluster": "asa-",
126+
"synapseWorkspaces": "syn",
127+
"synapseWorkspacesAnalyticsWorkspaces": "synw",
128+
"synapseWorkspacesSqlPoolsDedicated": "syndp",
129+
"synapseWorkspacesSqlPoolsSpark": "synsp",
130+
"timeSeriesInsightsEnvironments": "tsi-",
131+
"webServerFarms": "plan-",
132+
"webSitesAppService": "app-",
133+
"webSitesAppServiceEnvironment": "ase-",
134+
"webSitesFunctions": "func-",
135+
"webStaticSites": "stapp-"
136+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
metadata description = 'Updates app settings for an Azure App Service.'
2+
@description('The name of the app service resource within the current resource group scope')
3+
param name string
4+
5+
@description('The app settings to be applied to the app service')
6+
@secure()
7+
param appSettings object
8+
9+
resource appService 'Microsoft.Web/sites@2022-03-01' existing = {
10+
name: name
11+
}
12+
13+
resource settings 'Microsoft.Web/sites/config@2022-03-01' = {
14+
name: 'appsettings'
15+
parent: appService
16+
properties: appSettings
17+
}

infra/core/host/appservice.bicep

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
metadata description = 'Creates an Azure App Service in an existing Azure App Service plan.'
2+
param name string
3+
param location string = resourceGroup().location
4+
param tags object = {}
5+
6+
// Reference Properties
7+
param applicationInsightsName string = ''
8+
param appServicePlanId string
9+
param keyVaultName string = ''
10+
param managedIdentity bool = !empty(keyVaultName)
11+
12+
// Runtime Properties
13+
@allowed([
14+
'dotnet', 'dotnetcore', 'dotnet-isolated', 'node', 'python', 'java', 'powershell', 'custom'
15+
])
16+
param runtimeName string
17+
param runtimeNameAndVersion string = '${runtimeName}|${runtimeVersion}'
18+
param runtimeVersion string
19+
20+
// Microsoft.Web/sites Properties
21+
param kind string = 'app,linux'
22+
23+
// Microsoft.Web/sites/config
24+
param allowedOrigins array = []
25+
param alwaysOn bool = true
26+
param appCommandLine string = ''
27+
@secure()
28+
param appSettings object = {}
29+
param clientAffinityEnabled bool = false
30+
param enableOryxBuild bool = contains(kind, 'linux')
31+
param functionAppScaleLimit int = -1
32+
param linuxFxVersion string = runtimeNameAndVersion
33+
param minimumElasticInstanceCount int = -1
34+
param numberOfWorkers int = -1
35+
param scmDoBuildDuringDeployment bool = false
36+
param use32BitWorkerProcess bool = false
37+
param ftpsState string = 'FtpsOnly'
38+
param healthCheckPath string = ''
39+
40+
resource appService 'Microsoft.Web/sites@2022-03-01' = {
41+
name: name
42+
location: location
43+
tags: tags
44+
kind: kind
45+
properties: {
46+
serverFarmId: appServicePlanId
47+
siteConfig: {
48+
linuxFxVersion: linuxFxVersion
49+
alwaysOn: alwaysOn
50+
ftpsState: ftpsState
51+
minTlsVersion: '1.2'
52+
appCommandLine: appCommandLine
53+
numberOfWorkers: numberOfWorkers != -1 ? numberOfWorkers : null
54+
minimumElasticInstanceCount: minimumElasticInstanceCount != -1 ? minimumElasticInstanceCount : null
55+
use32BitWorkerProcess: use32BitWorkerProcess
56+
functionAppScaleLimit: functionAppScaleLimit != -1 ? functionAppScaleLimit : null
57+
healthCheckPath: healthCheckPath
58+
cors: {
59+
allowedOrigins: union([ 'https://portal.azure.com', 'https://ms.portal.azure.com' ], allowedOrigins)
60+
}
61+
}
62+
clientAffinityEnabled: clientAffinityEnabled
63+
httpsOnly: true
64+
}
65+
66+
identity: { type: managedIdentity ? 'SystemAssigned' : 'None' }
67+
68+
resource basicPublishingCredentialsPoliciesFtp 'basicPublishingCredentialsPolicies' = {
69+
name: 'ftp'
70+
properties: {
71+
allow: false
72+
}
73+
}
74+
75+
resource basicPublishingCredentialsPoliciesScm 'basicPublishingCredentialsPolicies' = {
76+
name: 'scm'
77+
properties: {
78+
allow: false
79+
}
80+
}
81+
}
82+
83+
// Updates to the single Microsoft.sites/web/config resources that need to be performed sequentially
84+
// sites/web/config 'appsettings'
85+
module configAppSettings 'appservice-appsettings.bicep' = {
86+
name: '${name}-appSettings'
87+
params: {
88+
name: appService.name
89+
appSettings: union(appSettings,
90+
{
91+
SCM_DO_BUILD_DURING_DEPLOYMENT: string(scmDoBuildDuringDeployment)
92+
ENABLE_ORYX_BUILD: string(enableOryxBuild)
93+
},
94+
runtimeName == 'python' && appCommandLine == '' ? { PYTHON_ENABLE_GUNICORN_MULTIWORKERS: 'true'} : {},
95+
!empty(applicationInsightsName) ? { APPLICATIONINSIGHTS_CONNECTION_STRING: applicationInsights.properties.ConnectionString } : {},
96+
!empty(keyVaultName) ? { AZURE_KEY_VAULT_ENDPOINT: keyVault.properties.vaultUri } : {})
97+
}
98+
}
99+
100+
// sites/web/config 'logs'
101+
resource configLogs 'Microsoft.Web/sites/config@2022-03-01' = {
102+
name: 'logs'
103+
parent: appService
104+
properties: {
105+
applicationLogs: { fileSystem: { level: 'Verbose' } }
106+
detailedErrorMessages: { enabled: true }
107+
failedRequestsTracing: { enabled: true }
108+
httpLogs: { fileSystem: { enabled: true, retentionInDays: 1, retentionInMb: 35 } }
109+
}
110+
dependsOn: [configAppSettings]
111+
}
112+
113+
resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = if (!(empty(keyVaultName))) {
114+
name: keyVaultName
115+
}
116+
117+
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing = if (!empty(applicationInsightsName)) {
118+
name: applicationInsightsName
119+
}
120+
121+
output identityPrincipalId string = managedIdentity ? appService.identity.principalId : ''
122+
output name string = appService.name
123+
output uri string = 'https://${appService.properties.defaultHostName}'

infra/core/host/appserviceplan.bicep

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
metadata description = 'Creates an Azure App Service plan.'
2+
param name string
3+
param location string = resourceGroup().location
4+
param tags object = {}
5+
6+
param kind string = ''
7+
param reserved bool = true
8+
param sku object
9+
10+
resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = {
11+
name: name
12+
location: location
13+
tags: tags
14+
sku: sku
15+
kind: kind
16+
properties: {
17+
reserved: reserved
18+
}
19+
}
20+
21+
output id string = appServicePlan.id
22+
output name string = appServicePlan.name

0 commit comments

Comments
 (0)