-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from seesharprun/update-aca
WIP: Use Azure Container Apps
- Loading branch information
Showing
22 changed files
with
464 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"appServicePlan": "app-service-plan", | ||
"appServiceSite": "app-service-site", | ||
"cosmosDbAccount": "cosmos-db-nosql" | ||
"containerRegistry": "containerreg", | ||
"containerAppsEnv": "container-env", | ||
"containerAppsApp": "container-app", | ||
"cosmosDbAccount": "cosmos-db-nosql", | ||
"userAssignedIdentity": "ua-id" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
metadata description = 'Create identity resources.' | ||
|
||
param identityName string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
|
||
module userAssignedIdentity '../core/security/identity/user-assigned.bicep' = { | ||
name: 'user-assigned-identity' | ||
params: { | ||
name: identityName | ||
location: location | ||
tags: tags | ||
} | ||
} | ||
|
||
output name string = userAssignedIdentity.outputs.name | ||
output resourceId string = userAssignedIdentity.outputs.resourceId | ||
output principalId string = userAssignedIdentity.outputs.principalId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
metadata description = 'Create container registries.' | ||
|
||
param registryName string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
|
||
module containerRegistry '../core/host/container-registry/registry.bicep' = { | ||
name: 'container-registry' | ||
params: { | ||
name: registryName | ||
location: location | ||
tags: tags | ||
adminUserEnabled: false | ||
anonymousPullEnabled: false | ||
publicNetworkAccessEnabled: true | ||
skuName: 'Basic' | ||
} | ||
} | ||
|
||
output endpoint string = containerRegistry.outputs.endpoint | ||
output name string = containerRegistry.outputs.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,58 @@ | ||
metadata description = 'Create Azure App Service resources.' | ||
metadata description = 'Create web application resources.' | ||
|
||
param planName string | ||
param siteName string | ||
param envName string | ||
param appName string | ||
param serviceTag string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
|
||
@description('Endpoint for Azure Cosmos DB for NoSQL account.') | ||
param databaseAccountEndpoint string | ||
|
||
module appServicePlan '../core/web/app-service/plan.bicep' = { | ||
name: 'app-service-plan' | ||
@description('Endpoint for private container registry.') | ||
param containerRegistryEndpoint string = '' | ||
|
||
module containerAppsEnvironment '../core/host/container-apps/environments/managed.bicep' = { | ||
name: 'container-apps-env' | ||
params: { | ||
name: planName | ||
name: envName | ||
location: location | ||
tags: tags | ||
kind: 'linux' // Use Linux | ||
sku: 'B1' // Basic tier | ||
} | ||
} | ||
|
||
module appServiceSite '../core/web/app-service/site.bicep' = { | ||
name: 'app-service-site' | ||
dependsOn: [ | ||
appServicePlan | ||
] | ||
module containerAppsApp '../core/host/container-apps/app.bicep' = { | ||
name: 'container-apps-app' | ||
params: { | ||
name: siteName | ||
parentPlanName: appServicePlan.outputs.name | ||
name: appName | ||
parentEnvironmentName: containerAppsEnvironment.outputs.name | ||
location: location | ||
tags: union(tags, { | ||
'azd-service-name': serviceTag | ||
}) | ||
runtimeName: 'dotnetcore' // ASP.NET | ||
runtimeVersion: '7.0' // .NET 7 (LTS) | ||
enableSystemAssignedManagedIdentity: true // Create system-assigned managed identity | ||
} | ||
} | ||
|
||
module appServiceConfig '../core/web/app-service/config.bicep' = { | ||
name: 'app-service-config' | ||
dependsOn: [ | ||
appServicePlan | ||
appServiceSite | ||
] | ||
params: { | ||
parentSiteName: appServiceSite.outputs.name | ||
appSettings: { | ||
SCM_DO_BUILD_DURING_DEPLOYMENT: string(false) | ||
ENABLE_ORYX_BUILD: string(true) | ||
WEBSITES_PORT: '80' | ||
AZURE_COSMOS_DB_NOSQL_ENDPOINT: databaseAccountEndpoint | ||
} | ||
containerImage: 'ghcr.io/azure-samples/cosmos-db-nosql-dotnet-quickstart:main' // Pre-built container image and tag from GitHub | ||
secrets: [ | ||
{ | ||
name: 'azure-cosmos-db-nosql-endpoint' // Create a uniquely-named secret | ||
value: databaseAccountEndpoint // NoSQL database account endpoint | ||
} | ||
] | ||
environmentVariables: [ | ||
{ | ||
name: 'AZURE_COSMOS_DB_NOSQL_ENDPOINT' // Name of the environment variable referenced in the application | ||
secretRef: 'azure-cosmos-db-nosql-endpoint' // Reference to secret | ||
} | ||
] | ||
enableSystemAssignedManagedIdentity: true | ||
privateRegistries: !empty(containerRegistryEndpoint) ? [ | ||
{ | ||
server: containerRegistryEndpoint // Endpoint to Azure Container Registry | ||
identity: 'system' | ||
} | ||
] : [] | ||
} | ||
} | ||
|
||
output endpoint string = appServiceSite.outputs.endpoint | ||
output siteName string = appServiceSite.outputs.name | ||
output siteManagedIdentityPrincipalId string = appServiceSite.outputs.managedIdentityPrincipalId | ||
output endpoint string = containerAppsApp.outputs.endpoint | ||
output envName string = containerAppsApp.outputs.name | ||
output managedIdentityPrincipalId string = containerAppsApp.outputs.systemAssignedManagedIdentityPrincipalId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"experimentalFeaturesEnabled": { | ||
"resourceTypedParamsAndOutputs": true, | ||
"userDefinedTypes": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.