-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathmain-environment.bicep
57 lines (50 loc) · 1.79 KB
/
main-environment.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
targetScope = 'subscription'
param location string = deployment().location
param resourceGroupName string
param environment string
param containerRegistryName string
param productionServicePrincipalObjectId string = ''
var tags = { environment: environment, 'managed-by': 'bicep' }
resource environmentResourceGroup 'Microsoft.Resources/resourceGroups@2024-11-01' = {
name: resourceGroupName
location: location
tags: tags
}
module containerRegistry '../modules/container-registry.bicep' = {
name: '${resourceGroupName}-container-registry'
scope: resourceGroup(environmentResourceGroup.name)
params: {
name: containerRegistryName
location: location
tags: tags
}
}
// Grant production service principal Container Registry Data Importer access to registry if specified
module productionServicePrincipalDataImporter '../modules/role-assignments-container-registry-data-importer.bicep' = if (!empty(productionServicePrincipalObjectId)) {
name: '${resourceGroupName}-production-sp-data-importer'
scope: resourceGroup(environmentResourceGroup.name)
params: {
containerRegistryName: containerRegistryName
principalId: productionServicePrincipalObjectId
}
dependsOn: [containerRegistry]
}
module logAnalyticsWorkspace '../modules/log-analytics-workspace.bicep' = {
name: '${resourceGroupName}-log-analytics-workspace'
scope: resourceGroup(environmentResourceGroup.name)
params: {
name: resourceGroupName
location: location
tags: tags
}
}
module applicationInsights '../modules/application-insights.bicep' = {
name: '${resourceGroupName}-application-insights'
scope: resourceGroup(environmentResourceGroup.name)
params: {
name: resourceGroupName
location: location
tags: tags
logAnalyticsWorkspaceId: logAnalyticsWorkspace.outputs.workspaceId
}
}