|
| 1 | +@description('The location used for all deployed resources') |
| 2 | +param location string = resourceGroup().location |
| 3 | +@description('Id of the user or app to assign application roles') |
| 4 | +param principalId string = '' |
| 5 | + |
| 6 | + |
| 7 | +@description('Tags that will be applied to all resources') |
| 8 | +param tags object = {} |
| 9 | + |
| 10 | +var resourceToken = uniqueString(resourceGroup().id) |
| 11 | + |
| 12 | +resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = { |
| 13 | + name: 'mi-${resourceToken}' |
| 14 | + location: location |
| 15 | + tags: tags |
| 16 | +} |
| 17 | + |
| 18 | +resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-07-01' = { |
| 19 | + name: replace('acr-${resourceToken}', '-', '') |
| 20 | + location: location |
| 21 | + sku: { |
| 22 | + name: 'Basic' |
| 23 | + } |
| 24 | + tags: tags |
| 25 | +} |
| 26 | + |
| 27 | +resource caeMiRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = { |
| 28 | + name: guid(containerRegistry.id, managedIdentity.id, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7f951dda-4ed3-4680-a7ca-43fe172d538d')) |
| 29 | + scope: containerRegistry |
| 30 | + properties: { |
| 31 | + principalId: managedIdentity.properties.principalId |
| 32 | + principalType: 'ServicePrincipal' |
| 33 | + roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7f951dda-4ed3-4680-a7ca-43fe172d538d') |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' = { |
| 38 | + name: 'law-${resourceToken}' |
| 39 | + location: location |
| 40 | + properties: { |
| 41 | + sku: { |
| 42 | + name: 'PerGB2018' |
| 43 | + } |
| 44 | + } |
| 45 | + tags: tags |
| 46 | +} |
| 47 | + |
| 48 | +resource containerAppEnvironment 'Microsoft.App/managedEnvironments@2024-02-02-preview' = { |
| 49 | + name: 'cae-${resourceToken}' |
| 50 | + location: location |
| 51 | + properties: { |
| 52 | + workloadProfiles: [{ |
| 53 | + workloadProfileType: 'Consumption' |
| 54 | + name: 'consumption' |
| 55 | + }] |
| 56 | + appLogsConfiguration: { |
| 57 | + destination: 'log-analytics' |
| 58 | + logAnalyticsConfiguration: { |
| 59 | + customerId: logAnalyticsWorkspace.properties.customerId |
| 60 | + sharedKey: logAnalyticsWorkspace.listKeys().primarySharedKey |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | + tags: tags |
| 65 | + |
| 66 | + resource aspireDashboard 'dotNetComponents' = { |
| 67 | + name: 'aspire-dashboard' |
| 68 | + properties: { |
| 69 | + componentType: 'AspireDashboard' |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | +} |
| 74 | + |
| 75 | +output MANAGED_IDENTITY_CLIENT_ID string = managedIdentity.properties.clientId |
| 76 | +output MANAGED_IDENTITY_NAME string = managedIdentity.name |
| 77 | +output MANAGED_IDENTITY_PRINCIPAL_ID string = managedIdentity.properties.principalId |
| 78 | +output AZURE_LOG_ANALYTICS_WORKSPACE_NAME string = logAnalyticsWorkspace.name |
| 79 | +output AZURE_LOG_ANALYTICS_WORKSPACE_ID string = logAnalyticsWorkspace.id |
| 80 | +output AZURE_CONTAINER_REGISTRY_ENDPOINT string = containerRegistry.properties.loginServer |
| 81 | +output AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID string = managedIdentity.id |
| 82 | +output AZURE_CONTAINER_REGISTRY_NAME string = containerRegistry.name |
| 83 | +output AZURE_CONTAINER_APPS_ENVIRONMENT_NAME string = containerAppEnvironment.name |
| 84 | +output AZURE_CONTAINER_APPS_ENVIRONMENT_ID string = containerAppEnvironment.id |
| 85 | +output AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN string = containerAppEnvironment.properties.defaultDomain |
0 commit comments