Skip to content

Commit

Permalink
Regen manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed Mar 18, 2024
1 parent 9fb0065 commit 0f0cd91
Show file tree
Hide file tree
Showing 8 changed files with 265 additions and 16 deletions.
99 changes: 99 additions & 0 deletions playground/bicep/BicepSample.AppHost/api-containerapp.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
param location string
param tags object = {}
param param_0 string // {containerAppEnv.outputs.id}
param param_1 string // {containerRegistry.outputs.loginServer}
param param_2 string // {containerRegistry.outputs.mid}
param param_3 string // {api.containerImage}
param param_4 string // {sql.outputs.sqlServerFqdn}
@secure()
param param_5 string // {postgres2.secretOutputs.connectionString}
@secure()
param param_6 string // {cosmos.secretOutputs.connectionString}
param param_7 string // {storage.outputs.blobEndpoint}
param param_8 string // {storage.outputs.tableEndpoint}
param param_9 string // {storage.outputs.queueEndpoint}
param param_10 string // {kv3.outputs.vaultUri}
param param_11 string // {appConfig.outputs.appConfigEndpoint}
param param_12 string // {ai.outputs.appInsightsConnectionString}
@secure()
param param_13 string // {redis.secretOutputs.connectionString}
param param_14 string // {sb.outputs.serviceBusEndpoint}
param param_15 string // {signalr.outputs.hostName}
param param_16 string // {test.outputs.test}
param param_17 string // {test.outputs.val0}
param param_18 string // {test.outputs.val1}
param param_19 string // {default-identity.outputs.id}
param param_20 string // {default-identity.outputs.clientId}

resource containerApp 'Microsoft.App/containerApps@2023-05-02-preview' = {
name: 'api'
location: location
tags: tags
identity: {
type: 'UserAssigned'
userAssignedIdentities: { '${param_19}': {} }
}
properties: {
environmentId: param_0
configuration: {
activeRevisionsMode: 'Single'
ingress: {
external: false
targetPort: 8080
transport: 'http'
}
registries: [ {
server: param_1
identity: param_2
} ]
secrets: [
{ name: 'connectionstrings--db', value: 'Server=tcp:${param_4},1433;Encrypt=True;Authentication="Active Directory Default";Database=db' }
{ name: 'connectionstrings--db2', value: '${param_5};Database=db2' }
{ name: 'connectionstrings--cosmos', value: param_6 }
{ name: 'connectionstrings--blob', value: param_7 }
{ name: 'connectionstrings--table', value: param_8 }
{ name: 'connectionstrings--queue', value: param_9 }
{ name: 'connectionstrings--kv3', value: param_10 }
{ name: 'connectionstrings--appconfig', value: param_11 }
{ name: 'applicationinsights_connection_string', value: param_12 }
{ name: 'connectionstrings--redis', value: param_13 }
{ name: 'connectionstrings--sb', value: param_14 }
{ name: 'connectionstrings--signalr', value: 'Endpoint=https://${param_15};AuthType=azure' }
]

}
template: {
scale: {
minReplicas: 1
}
containers: [
{
image: param_3
name: 'api'
env: [
{ name: 'OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES', value: 'true' }
{ name: 'OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES', value: 'true' }
{ name: 'ASPNETCORE_FORWARDEDHEADERS_ENABLED', value: 'true' }
{ name: 'ConnectionStrings__db', secretRef: 'connectionstrings--db' }
{ name: 'ConnectionStrings__db2', secretRef: 'connectionstrings--db2' }
{ name: 'ConnectionStrings__cosmos', secretRef: 'connectionstrings--cosmos' }
{ name: 'ConnectionStrings__blob', secretRef: 'connectionstrings--blob' }
{ name: 'ConnectionStrings__table', secretRef: 'connectionstrings--table' }
{ name: 'ConnectionStrings__queue', secretRef: 'connectionstrings--queue' }
{ name: 'ConnectionStrings__kv3', secretRef: 'connectionstrings--kv3' }
{ name: 'ConnectionStrings__appConfig', secretRef: 'connectionstrings--appconfig' }
{ name: 'APPLICATIONINSIGHTS_CONNECTION_STRING', secretRef: 'applicationinsights_connection_string' }
{ name: 'ConnectionStrings__redis', secretRef: 'connectionstrings--redis' }
{ name: 'ConnectionStrings__sb', secretRef: 'connectionstrings--sb' }
{ name: 'ConnectionStrings__signalr', secretRef: 'connectionstrings--signalr' }
{ name: 'bicepValue_test', value: param_16 }
{ name: 'bicepValue0', value: param_17 }
{ name: 'bicepValue1', value: param_18 }
{ name: 'AZURE_CLIENT_ID', value: param_20 }
]

}
]
}
}
}
76 changes: 60 additions & 16 deletions playground/bicep/BicepSample.AppHost/aspire-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,33 @@
},
"test0": {
"type": "azure.bicep.v0",
"path": "../../../../../Users/midenn/AppData/Local/Temp/tmp0cmpqc.tmp.bicep"
"path": "test0.bicep"
},
"kv3": {
"type": "azure.bicep.v0",
"connectionString": "{kv3.outputs.vaultUri}",
"path": "kv3.module.bicep",
"params": {
"principalId": "",
"principalType": ""
"principalId": "{default-identity.outputs.principalId}",
"principalType": "ServicePrincipal"
}
},
"appConfig": {
"type": "azure.bicep.v0",
"connectionString": "{appConfig.outputs.appConfigEndpoint}",
"path": "appConfig.module.bicep",
"params": {
"principalId": "",
"principalType": "",
"principalId": "{default-identity.outputs.principalId}",
"principalType": "ServicePrincipal",
"sku": "standard"
}
},
"storage": {
"type": "azure.bicep.v0",
"path": "storage.module.bicep",
"params": {
"principalId": "",
"principalType": ""
"principalId": "{default-identity.outputs.principalId}",
"principalType": "ServicePrincipal"
}
},
"blob": {
Expand All @@ -69,8 +69,9 @@
"connectionString": "Server=tcp:{sql.outputs.sqlServerFqdn},1433;Encrypt=True;Authentication=\u0022Active Directory Default\u0022",
"path": "sql.module.bicep",
"params": {
"principalId": "",
"principalName": ""
"principalId": "{default-identity.outputs.principalId}",
"principalName": "",
"principalType": "ServicePrincipal"
},
"inputs": {
"password": {
Expand Down Expand Up @@ -141,16 +142,16 @@
"connectionString": "{cosmos.secretOutputs.connectionString}",
"path": "cosmos.module.bicep",
"params": {
"keyVaultName": ""
"keyVaultName": "{cosmos-kv.outputs.name}"
}
},
"ai": {
"type": "azure.bicep.v0",
"connectionString": "{ai.outputs.appInsightsConnectionString}",
"path": "ai.module.bicep",
"params": {
"principalId": "",
"principalType": ""
"principalId": "{default-identity.outputs.principalId}",
"principalType": "ServicePrincipal"
}
},
"redis": {
Expand All @@ -167,17 +168,17 @@
"connectionString": "{sb.outputs.serviceBusEndpoint}",
"path": "sb.module.bicep",
"params": {
"principalId": "",
"principalType": ""
"principalId": "{default-identity.outputs.principalId}",
"principalType": "ServicePrincipal"
}
},
"signalr": {
"type": "azure.bicep.v0",
"connectionString": "Endpoint=https://{signalr.outputs.hostName};AuthType=azure",
"path": "signalr.module.bicep",
"params": {
"principalId": "",
"principalType": ""
"principalId": "{default-identity.outputs.principalId}",
"principalType": "ServicePrincipal"
}
},
"api": {
Expand Down Expand Up @@ -215,6 +216,49 @@
"transport": "http"
}
}
},
"containerAppEnv": {
"type": "azure.bicep.v0",
"path": "containerappenv.bicep"
},
"containerRegistry": {
"type": "azure.bicep.v0",
"path": "containerregistry.bicep"
},
"cosmos-kv": {
"type": "azure.bicep.v0",
"path": "cosmos-kv.bicep"
},
"default-identity": {
"type": "azure.bicep.v0",
"path": "default-identity.bicep"
},
"api-containerApp": {
"type": "azure.bicep.v0",
"path": "api-containerapp.bicep",
"params": {
"param_0": "{containerAppEnv.outputs.id}",
"param_1": "{containerRegistry.outputs.loginServer}",
"param_2": "{containerRegistry.outputs.mid}",
"param_3": "{api.containerImage}",
"param_4": "{sql.outputs.sqlServerFqdn}",
"param_5": "{postgres2.secretOutputs.connectionString}",
"param_6": "{cosmos.secretOutputs.connectionString}",
"param_7": "{storage.outputs.blobEndpoint}",
"param_8": "{storage.outputs.tableEndpoint}",
"param_9": "{storage.outputs.queueEndpoint}",
"param_10": "{kv3.outputs.vaultUri}",
"param_11": "{appConfig.outputs.appConfigEndpoint}",
"param_12": "{ai.outputs.appInsightsConnectionString}",
"param_13": "{redis.secretOutputs.connectionString}",
"param_14": "{sb.outputs.serviceBusEndpoint}",
"param_15": "{signalr.outputs.hostName}",
"param_16": "{test.outputs.test}",
"param_17": "{test.outputs.val0}",
"param_18": "{test.outputs.val1}",
"param_19": "{default-identity.outputs.id}",
"param_20": "{default-identity.outputs.clientId}"
}
}
}
}
34 changes: 34 additions & 0 deletions playground/bicep/BicepSample.AppHost/containerappenv.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
param location string
param tags object

var resourceToken = uniqueString(resourceGroup().id)

resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: 'law-${resourceToken}'
location: location
properties: {
sku: {
name: 'PerGB2018'
}
}
tags: tags
}

resource containerAppEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' = {
name: 'cae-${resourceToken}'
location: location
properties: {
appLogsConfiguration: {
destination: 'log-analytics'
logAnalyticsConfiguration: {
customerId: logAnalyticsWorkspace.properties.customerId
sharedKey: logAnalyticsWorkspace.listKeys().primarySharedKey
}
}
}
tags: tags
}

output id string = containerAppEnvironment.id
output logAnalyticsWorkspaceId string = logAnalyticsWorkspace.id
output defaultDomain string = containerAppEnvironment.properties.defaultDomain
37 changes: 37 additions & 0 deletions playground/bicep/BicepSample.AppHost/containerregistry.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
param location string
param tags object
param sku string = 'Basic'
param adminUserEnabled bool = true

var resourceToken = uniqueString(resourceGroup().id)

resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-07-01' = {
name: replace('acr${resourceToken}', '-', '')
location: location
sku: {
name: sku
}
properties: {
adminUserEnabled: adminUserEnabled
}
tags: tags
}

resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'mi-${resourceToken}'
location: location
tags: tags
}

resource caeMiRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(containerRegistry.id, managedIdentity.id, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7f951dda-4ed3-4680-a7ca-43fe172d538d'))
scope: containerRegistry
properties: {
principalId: managedIdentity.properties.principalId
principalType: 'ServicePrincipal'
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7f951dda-4ed3-4680-a7ca-43fe172d538d')
}
}

output mid string = managedIdentity.id
output loginServer string = containerRegistry.properties.loginServer
18 changes: 18 additions & 0 deletions playground/bicep/BicepSample.AppHost/cosmos-kv.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
param location string
param tags object

resource keyVault 'Microsoft.KeyVault/vaults@2022-02-01-preview' = {
name: 'kv-${uniqueString(resourceGroup().id)}'
location: location
properties: {
sku: {
family: 'A'
name: 'standard'
}
tenantId: subscription().tenantId
accessPolicies: []
}
tags: tags
}

output name string = keyVault.name
12 changes: 12 additions & 0 deletions playground/bicep/BicepSample.AppHost/default-identity.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
param location string
param tags object

resource identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'cai-${uniqueString(resourceGroup().id)}'
location: location
tags: tags
}

output id string = identity.id
output clientId string = identity.properties.clientId
output principalId string = identity.properties.principalId
3 changes: 3 additions & 0 deletions playground/bicep/BicepSample.AppHost/sql.module.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ param principalId string
@description('')
param principalName string

@description('')
param principalType string


resource sqlServer_l5O9GRsSn 'Microsoft.Sql/servers@2020-11-01-preview' = {
name: toLower(take(concat('sql', uniqueString(resourceGroup().id)), 24))
Expand Down
2 changes: 2 additions & 0 deletions playground/bicep/BicepSample.AppHost/test0.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
param location string = ''
output val0 string = location

0 comments on commit 0f0cd91

Please sign in to comment.