This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,886 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ out/ | |
|
||
### VS Code ### | ||
.vscode/ | ||
.azure |
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,10 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json | ||
|
||
name: crescendo-server | ||
metadata: | ||
template: [email protected] | ||
services: | ||
crescendo-server: | ||
project: . | ||
host: containerapp | ||
language: java |
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,135 @@ | ||
{ | ||
"analysisServicesServers": "as", | ||
"apiManagementService": "apim-", | ||
"appConfigurationStores": "appcs-", | ||
"appManagedEnvironments": "cae-", | ||
"appContainerApps": "ca-", | ||
"authorizationPolicyDefinitions": "policy-", | ||
"automationAutomationAccounts": "aa-", | ||
"blueprintBlueprints": "bp-", | ||
"blueprintBlueprintsArtifacts": "bpa-", | ||
"cacheRedis": "redis-", | ||
"cdnProfiles": "cdnp-", | ||
"cdnProfilesEndpoints": "cdne-", | ||
"cognitiveServicesAccounts": "cog-", | ||
"cognitiveServicesFormRecognizer": "cog-fr-", | ||
"cognitiveServicesTextAnalytics": "cog-ta-", | ||
"computeAvailabilitySets": "avail-", | ||
"computeCloudServices": "cld-", | ||
"computeDiskEncryptionSets": "des", | ||
"computeDisks": "disk", | ||
"computeDisksOs": "osdisk", | ||
"computeGalleries": "gal", | ||
"computeSnapshots": "snap-", | ||
"computeVirtualMachines": "vm", | ||
"computeVirtualMachineScaleSets": "vmss-", | ||
"containerInstanceContainerGroups": "ci", | ||
"containerRegistryRegistries": "cr", | ||
"containerServiceManagedClusters": "aks-", | ||
"databricksWorkspaces": "dbw-", | ||
"dataFactoryFactories": "adf-", | ||
"dataLakeAnalyticsAccounts": "dla", | ||
"dataLakeStoreAccounts": "dls", | ||
"dataMigrationServices": "dms-", | ||
"dBforMySQLServers": "mysql-", | ||
"dBforPostgreSQLServers": "psql-", | ||
"devicesIotHubs": "iot-", | ||
"devicesProvisioningServices": "provs-", | ||
"devicesProvisioningServicesCertificates": "pcert-", | ||
"documentDBDatabaseAccounts": "cosmos-", | ||
"eventGridDomains": "evgd-", | ||
"eventGridDomainsTopics": "evgt-", | ||
"eventGridEventSubscriptions": "evgs-", | ||
"eventHubNamespaces": "evhns-", | ||
"eventHubNamespacesEventHubs": "evh-", | ||
"hdInsightClustersHadoop": "hadoop-", | ||
"hdInsightClustersHbase": "hbase-", | ||
"hdInsightClustersKafka": "kafka-", | ||
"hdInsightClustersMl": "mls-", | ||
"hdInsightClustersSpark": "spark-", | ||
"hdInsightClustersStorm": "storm-", | ||
"hybridComputeMachines": "arcs-", | ||
"insightsActionGroups": "ag-", | ||
"insightsComponents": "appi-", | ||
"keyVaultVaults": "kv-", | ||
"kubernetesConnectedClusters": "arck", | ||
"kustoClusters": "dec", | ||
"kustoClustersDatabases": "dedb", | ||
"logicIntegrationAccounts": "ia-", | ||
"logicWorkflows": "logic-", | ||
"machineLearningServicesWorkspaces": "mlw-", | ||
"managedIdentityUserAssignedIdentities": "id-", | ||
"managementManagementGroups": "mg-", | ||
"migrateAssessmentProjects": "migr-", | ||
"networkApplicationGateways": "agw-", | ||
"networkApplicationSecurityGroups": "asg-", | ||
"networkAzureFirewalls": "afw-", | ||
"networkBastionHosts": "bas-", | ||
"networkConnections": "con-", | ||
"networkDnsZones": "dnsz-", | ||
"networkExpressRouteCircuits": "erc-", | ||
"networkFirewallPolicies": "afwp-", | ||
"networkFirewallPoliciesWebApplication": "waf", | ||
"networkFirewallPoliciesRuleGroups": "wafrg", | ||
"networkFrontDoors": "fd-", | ||
"networkFrontdoorWebApplicationFirewallPolicies": "fdfp-", | ||
"networkLoadBalancersExternal": "lbe-", | ||
"networkLoadBalancersInternal": "lbi-", | ||
"networkLoadBalancersInboundNatRules": "rule-", | ||
"networkLocalNetworkGateways": "lgw-", | ||
"networkNatGateways": "ng-", | ||
"networkNetworkInterfaces": "nic-", | ||
"networkNetworkSecurityGroups": "nsg-", | ||
"networkNetworkSecurityGroupsSecurityRules": "nsgsr-", | ||
"networkNetworkWatchers": "nw-", | ||
"networkPrivateDnsZones": "pdnsz-", | ||
"networkPrivateLinkServices": "pl-", | ||
"networkPublicIPAddresses": "pip-", | ||
"networkPublicIPPrefixes": "ippre-", | ||
"networkRouteFilters": "rf-", | ||
"networkRouteTables": "rt-", | ||
"networkRouteTablesRoutes": "udr-", | ||
"networkTrafficManagerProfiles": "traf-", | ||
"networkVirtualNetworkGateways": "vgw-", | ||
"networkVirtualNetworks": "vnet-", | ||
"networkVirtualNetworksSubnets": "snet-", | ||
"networkVirtualNetworksVirtualNetworkPeerings": "peer-", | ||
"networkVirtualWans": "vwan-", | ||
"networkVpnGateways": "vpng-", | ||
"networkVpnGatewaysVpnConnections": "vcn-", | ||
"networkVpnGatewaysVpnSites": "vst-", | ||
"notificationHubsNamespaces": "ntfns-", | ||
"notificationHubsNamespacesNotificationHubs": "ntf-", | ||
"operationalInsightsWorkspaces": "log-", | ||
"portalDashboards": "dash-", | ||
"powerBIDedicatedCapacities": "pbi-", | ||
"purviewAccounts": "pview-", | ||
"recoveryServicesVaults": "rsv-", | ||
"resourcesResourceGroups": "rg-", | ||
"searchSearchServices": "srch-", | ||
"serviceBusNamespaces": "sb-", | ||
"serviceBusNamespacesQueues": "sbq-", | ||
"serviceBusNamespacesTopics": "sbt-", | ||
"serviceEndPointPolicies": "se-", | ||
"serviceFabricClusters": "sf-", | ||
"signalRServiceSignalR": "sigr", | ||
"sqlManagedInstances": "sqlmi-", | ||
"sqlServers": "sql-", | ||
"sqlServersDataWarehouse": "sqldw-", | ||
"sqlServersDatabases": "sqldb-", | ||
"sqlServersDatabasesStretch": "sqlstrdb-", | ||
"storageStorageAccounts": "st", | ||
"storageStorageAccountsVm": "stvm", | ||
"storSimpleManagers": "ssimp", | ||
"streamAnalyticsCluster": "asa-", | ||
"synapseWorkspaces": "syn", | ||
"synapseWorkspacesAnalyticsWorkspaces": "synw", | ||
"synapseWorkspacesSqlPoolsDedicated": "syndp", | ||
"synapseWorkspacesSqlPoolsSpark": "synsp", | ||
"timeSeriesInsightsEnvironments": "tsi-", | ||
"webServerFarms": "plan-", | ||
"webSitesAppService": "app-", | ||
"webSitesAppServiceEnvironment": "ase-", | ||
"webSitesFunctions": "func-", | ||
"webStaticSites": "stapp-" | ||
} |
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,127 @@ | ||
param name string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
|
||
param identityName string | ||
param containerRegistryName string | ||
param containerAppsEnvironmentName string | ||
param applicationInsightsName string | ||
param exists bool | ||
@secure() | ||
param appDefinition object | ||
|
||
var appSettingsArray = filter(array(appDefinition.settings), i => i.name != '') | ||
var secrets = map(filter(appSettingsArray, i => i.?secret != null), i => { | ||
name: i.name | ||
value: i.value | ||
secretRef: i.?secretRef ?? take(replace(replace(toLower(i.name), '_', '-'), '.', '-'), 32) | ||
}) | ||
var env = map(filter(appSettingsArray, i => i.?secret == null), i => { | ||
name: i.name | ||
value: i.value | ||
}) | ||
|
||
resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { | ||
name: identityName | ||
location: location | ||
} | ||
|
||
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-01-01-preview' existing = { | ||
name: containerRegistryName | ||
} | ||
|
||
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' existing = { | ||
name: containerAppsEnvironmentName | ||
} | ||
|
||
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' existing = { | ||
name: applicationInsightsName | ||
} | ||
|
||
resource acrPullRole 'Microsoft.Authorization/roleAssignments@2022-04-01' = { | ||
scope: containerRegistry | ||
name: guid(subscription().id, resourceGroup().id, identity.id, 'acrPullRole') | ||
properties: { | ||
roleDefinitionId: subscriptionResourceId( | ||
'Microsoft.Authorization/roleDefinitions', '7f951dda-4ed3-4680-a7ca-43fe172d538d') | ||
principalType: 'ServicePrincipal' | ||
principalId: identity.properties.principalId | ||
} | ||
} | ||
|
||
module fetchLatestImage '../modules/fetch-container-image.bicep' = { | ||
name: '${name}-fetch-image' | ||
params: { | ||
exists: exists | ||
name: name | ||
} | ||
} | ||
|
||
resource app 'Microsoft.App/containerApps@2023-05-02-preview' = { | ||
name: name | ||
location: location | ||
tags: union(tags, {'azd-service-name': 'crescendo-server' }) | ||
dependsOn: [ acrPullRole ] | ||
identity: { | ||
type: 'UserAssigned' | ||
userAssignedIdentities: { '${identity.id}': {} } | ||
} | ||
properties: { | ||
managedEnvironmentId: containerAppsEnvironment.id | ||
configuration: { | ||
ingress: { | ||
external: true | ||
targetPort: 8080 | ||
transport: 'auto' | ||
} | ||
registries: [ | ||
{ | ||
server: '${containerRegistryName}.azurecr.io' | ||
identity: identity.id | ||
} | ||
] | ||
secrets: union([ | ||
], | ||
map(secrets, secret => { | ||
name: secret.secretRef | ||
value: secret.value | ||
})) | ||
} | ||
template: { | ||
containers: [ | ||
{ | ||
image: fetchLatestImage.outputs.?containers[?0].?image ?? 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest' | ||
name: 'main' | ||
env: union([ | ||
{ | ||
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' | ||
value: applicationInsights.properties.ConnectionString | ||
} | ||
{ | ||
name: 'PORT' | ||
value: '8080' | ||
} | ||
], | ||
env, | ||
map(secrets, secret => { | ||
name: secret.name | ||
secretRef: secret.secretRef | ||
})) | ||
resources: { | ||
cpu: json('1.0') | ||
memory: '2.0Gi' | ||
} | ||
} | ||
] | ||
scale: { | ||
minReplicas: 1 | ||
maxReplicas: 10 | ||
} | ||
} | ||
} | ||
} | ||
|
||
output defaultDomain string = containerAppsEnvironment.properties.defaultDomain | ||
output name string = app.name | ||
output uri string = 'https://${app.properties.configuration.ingress.fqdn}' | ||
output id string = app.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
targetScope = 'subscription' | ||
|
||
@minLength(1) | ||
@maxLength(64) | ||
@description('Name of the environment that can be used as part of naming resource convention') | ||
param environmentName string | ||
|
||
@minLength(1) | ||
@description('Primary location for all resources') | ||
param location string | ||
|
||
param crescendoServerExists bool | ||
@secure() | ||
param crescendoServerDefinition object | ||
|
||
@description('Id of the user or app to assign application roles') | ||
param principalId string | ||
|
||
// Tags that should be applied to all resources. | ||
// | ||
// Note that 'azd-service-name' tags should be applied separately to service host resources. | ||
// Example usage: | ||
// tags: union(tags, { 'azd-service-name': <service name in azure.yaml> }) | ||
var tags = { | ||
'azd-env-name': environmentName | ||
} | ||
|
||
var abbrs = loadJsonContent('./abbreviations.json') | ||
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location)) | ||
|
||
resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' = { | ||
name: 'rg-${environmentName}' | ||
location: location | ||
tags: tags | ||
} | ||
|
||
module monitoring './shared/monitoring.bicep' = { | ||
name: 'monitoring' | ||
params: { | ||
location: location | ||
tags: tags | ||
logAnalyticsName: '${abbrs.operationalInsightsWorkspaces}${resourceToken}' | ||
applicationInsightsName: '${abbrs.insightsComponents}${resourceToken}' | ||
} | ||
scope: rg | ||
} | ||
|
||
module dashboard './shared/dashboard-web.bicep' = { | ||
name: 'dashboard' | ||
params: { | ||
name: '${abbrs.portalDashboards}${resourceToken}' | ||
applicationInsightsName: monitoring.outputs.applicationInsightsName | ||
location: location | ||
tags: tags | ||
} | ||
scope: rg | ||
} | ||
|
||
module registry './shared/registry.bicep' = { | ||
name: 'registry' | ||
params: { | ||
location: location | ||
tags: tags | ||
name: '${abbrs.containerRegistryRegistries}${resourceToken}' | ||
} | ||
scope: rg | ||
} | ||
|
||
module keyVault './shared/keyvault.bicep' = { | ||
name: 'keyvault' | ||
params: { | ||
location: location | ||
tags: tags | ||
name: '${abbrs.keyVaultVaults}${resourceToken}' | ||
principalId: principalId | ||
} | ||
scope: rg | ||
} | ||
|
||
module appsEnv './shared/apps-env.bicep' = { | ||
name: 'apps-env' | ||
params: { | ||
name: '${abbrs.appManagedEnvironments}${resourceToken}' | ||
location: location | ||
tags: tags | ||
applicationInsightsName: monitoring.outputs.applicationInsightsName | ||
logAnalyticsWorkspaceName: monitoring.outputs.logAnalyticsWorkspaceName | ||
} | ||
scope: rg | ||
} | ||
|
||
module crescendoServer './app/crescendo-server.bicep' = { | ||
name: 'crescendo-server' | ||
params: { | ||
name: '${abbrs.appContainerApps}crescendo-se-${resourceToken}' | ||
location: location | ||
tags: tags | ||
identityName: '${abbrs.managedIdentityUserAssignedIdentities}crescendo-se-${resourceToken}' | ||
applicationInsightsName: monitoring.outputs.applicationInsightsName | ||
containerAppsEnvironmentName: appsEnv.outputs.name | ||
containerRegistryName: registry.outputs.name | ||
exists: crescendoServerExists | ||
appDefinition: crescendoServerDefinition | ||
} | ||
scope: rg | ||
} | ||
|
||
output AZURE_CONTAINER_REGISTRY_ENDPOINT string = registry.outputs.loginServer | ||
output AZURE_KEY_VAULT_NAME string = keyVault.outputs.name | ||
output AZURE_KEY_VAULT_ENDPOINT string = keyVault.outputs.endpoint |
Oops, something went wrong.