-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathcontainerRegistry.bicep
134 lines (119 loc) · 3.21 KB
/
containerRegistry.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// Parameters
@description('Name of your Azure Container Registry')
@minLength(5)
@maxLength(50)
param name string = 'acr${uniqueString(resourceGroup().id)}'
@description('Enable admin user that have push / pull permission to the registry.')
param adminUserEnabled bool = true
@description('Specifies whether to allow public network access for the container registry.')
@allowed([
'Disabled'
'Enabled'
])
param publicNetworkAccess string = 'Enabled'
@description('Tier of your Azure Container Registry.')
@allowed([
'Basic'
'Standard'
'Premium'
])
param sku string = 'Premium'
@description('Specifies whether or not registry-wide pull is enabled from unauthenticated clients.')
param anonymousPullEnabled bool = true
@description('Specifies whether or not a single data endpoint is enabled per region for serving data.')
param dataEndpointEnabled bool = true
@description('Specifies the network rule set for the container registry.')
param networkRuleSet object = {
defaultAction: 'Allow'
}
@description('Specifies ehether to allow trusted Azure services to access a network restricted registry.')
@allowed([
'AzureServices'
'None'
])
param networkRuleBypassOptions string = 'AzureServices'
@description('Specifies whether or not zone redundancy is enabled for this container registry.')
@allowed([
'Disabled'
'Enabled'
])
param zoneRedundancy string = 'Disabled'
@description('Specifies the resource id of the Log Analytics workspace.')
param workspaceId string
@description('Specifies the location.')
param location string = resourceGroup().location
@description('Specifies the resource tags.')
param tags object
// Variables
var diagnosticSettingsName = 'diagnosticSettings'
var logCategories = [
'ContainerRegistryRepositoryEvents'
'ContainerRegistryLoginEvents'
]
var metricCategories = [
'AllMetrics'
]
var logs = [
for category in logCategories: {
category: category
enabled: true
retentionPolicy: {
enabled: true
days: 0
}
}
]
var metrics = [
for category in metricCategories: {
category: category
enabled: true
retentionPolicy: {
enabled: true
days: 0
}
}
]
// Resources
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-01-01-preview' = {
name: name
location: location
tags: tags
sku: {
name: sku
}
properties: {
adminUserEnabled: adminUserEnabled
anonymousPullEnabled: anonymousPullEnabled
dataEndpointEnabled: dataEndpointEnabled
networkRuleBypassOptions: networkRuleBypassOptions
networkRuleSet: networkRuleSet
policies: {
quarantinePolicy: {
status: 'disabled'
}
retentionPolicy: {
status: 'enabled'
days: 7
}
trustPolicy: {
status: 'enabled'
type: 'Notary'
}
}
publicNetworkAccess: publicNetworkAccess
zoneRedundancy: zoneRedundancy
}
}
resource diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
name: diagnosticSettingsName
scope: containerRegistry
properties: {
workspaceId: workspaceId
logs: logs
metrics: metrics
}
}
// Outputs
output id string = containerRegistry.id
output name string = containerRegistry.name
output sku string = containerRegistry.sku.name