forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustCloudMachine.bicep
More file actions
240 lines (219 loc) · 8.01 KB
/
JustCloudMachine.bicep
File metadata and controls
240 lines (219 loc) · 8.01 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
@description('The location for the resource(s) to be deployed.')
param location string = resourceGroup().location
@description('The objectId of the current user principal.')
param principalId string
resource cm_identity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
name: 'cm0c420d2f21084cd'
location: location
}
resource cm_storage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'cm0c420d2f21084cd'
kind: 'StorageV2'
location: location
sku: {
name: 'Standard_LRS'
}
properties: {
allowBlobPublicAccess: false
isHnsEnabled: true
}
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${cm_identity.id}': { }
}
}
}
resource cm_storage_00000000_0000_0000_0000_000000000000_StorageBlobDataContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid('cm_storage', principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'))
properties: {
principalId: principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')
principalType: 'User'
}
scope: cm_storage
}
resource cm_storage_cm_identity_StorageBlobDataContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid('cm_storage', cm_identity.id, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe'))
properties: {
principalId: cm_identity.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe')
principalType: 'ServicePrincipal'
}
scope: cm_storage
}
resource cm_storage_00000000_0000_0000_0000_000000000000_StorageTableDataContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid('cm_storage', principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3'))
properties: {
principalId: principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')
principalType: 'User'
}
scope: cm_storage
}
resource cm_storage_cm_identity_StorageTableDataContributor 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid('cm_storage', cm_identity.id, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3'))
properties: {
principalId: cm_identity.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '0a9a7e1f-b9d0-4cc4-a60d-0319b160aaa3')
principalType: 'ServicePrincipal'
}
scope: cm_storage
}
resource cm_storage_blobs 'Microsoft.Storage/storageAccounts/blobServices@2024-01-01' = {
name: 'default'
parent: cm_storage
}
resource cm_storage_blobs_container_default 'Microsoft.Storage/storageAccounts/blobServices/containers@2023-01-01' = {
name: 'default'
parent: cm_storage_blobs
}
resource cm_servicebus 'Microsoft.ServiceBus/namespaces@2024-01-01' = {
name: 'cm0c420d2f21084cd'
location: location
sku: {
name: 'Standard'
tier: 'Standard'
}
}
resource cm_servicebus_00000000_0000_0000_0000_000000000000_AzureServiceBusDataOwner 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid('cm_servicebus', principalId, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '090c5cfd-751d-490a-894a-3ce6f1109419'))
properties: {
principalId: principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '090c5cfd-751d-490a-894a-3ce6f1109419')
principalType: 'User'
}
scope: cm_servicebus
}
resource cm_servicebus_cm_identity_AzureServiceBusDataOwner 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid('cm_servicebus', cm_identity.id, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '090c5cfd-751d-490a-894a-3ce6f1109419'))
properties: {
principalId: cm_identity.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '090c5cfd-751d-490a-894a-3ce6f1109419')
principalType: 'ServicePrincipal'
}
scope: cm_servicebus
}
resource cm_servicebus_auth_rule 'Microsoft.ServiceBus/namespaces/AuthorizationRules@2021-11-01' = {
name: take('cm_servicebus_auth_rule-${uniqueString(resourceGroup().id)}', 50)
properties: {
rights: [
'Listen'
'Send'
'Manage'
]
}
parent: cm_servicebus
}
resource cm_servicebus_topic_private 'Microsoft.ServiceBus/namespaces/topics@2021-11-01' = {
name: 'cm_servicebus_topic_private'
properties: {
defaultMessageTimeToLive: 'P14D'
enableBatchedOperations: true
maxMessageSizeInKilobytes: 256
requiresDuplicateDetection: false
status: 'Active'
supportOrdering: true
}
parent: cm_servicebus
}
resource cm_servicebus_default_topic 'Microsoft.ServiceBus/namespaces/topics@2021-11-01' = {
name: 'cm_servicebus_default_topic'
properties: {
defaultMessageTimeToLive: 'P14D'
enableBatchedOperations: true
maxMessageSizeInKilobytes: 256
requiresDuplicateDetection: false
status: 'Active'
supportOrdering: true
}
parent: cm_servicebus
}
resource cm_servicebus_subscription_private 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2021-11-01' = {
name: 'cm_servicebus_subscription_private'
properties: {
deadLetteringOnFilterEvaluationExceptions: true
deadLetteringOnMessageExpiration: true
defaultMessageTimeToLive: 'P14D'
enableBatchedOperations: true
isClientAffine: false
lockDuration: 'PT30S'
maxDeliveryCount: 10
requiresSession: false
status: 'Active'
}
parent: cm_servicebus_topic_private
}
resource cm_servicebus_subscription_default 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2021-11-01' = {
name: 'cm_servicebus_subscription_default'
properties: {
deadLetteringOnFilterEvaluationExceptions: true
deadLetteringOnMessageExpiration: true
defaultMessageTimeToLive: 'P14D'
enableBatchedOperations: true
isClientAffine: false
lockDuration: 'PT30S'
maxDeliveryCount: 10
requiresSession: false
status: 'Active'
}
parent: cm_servicebus_default_topic
}
resource cm_eventgrid_topic 'Microsoft.EventGrid/systemTopics@2022-06-15' = {
name: 'cm0c420d2f21084cd'
location: location
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${cm_identity.id}': { }
}
}
properties: {
source: cm_storage.id
topicType: 'Microsoft.Storage.StorageAccounts'
}
}
resource cm_eventgrid_subscription_blob 'Microsoft.EventGrid/systemTopics/eventSubscriptions@2022-06-15' = {
name: 'cm-eventgrid-subscription-blob'
properties: {
deliveryWithResourceIdentity: {
identity: {
type: 'UserAssigned'
userAssignedIdentity: cm_identity.id
}
destination: {
endpointType: 'ServiceBusTopic'
properties: {
resourceId: cm_servicebus_topic_private.id
}
}
}
eventDeliverySchema: 'EventGridSchema'
filter: {
includedEventTypes: [
'Microsoft.Storage.BlobCreated'
'Microsoft.Storage.BlobDeleted'
'Microsoft.Storage.BlobRenamed'
]
enableAdvancedFilteringOnArrays: true
}
retryPolicy: {
maxDeliveryAttempts: 30
eventTimeToLiveInMinutes: 1440
}
}
parent: cm_eventgrid_topic
dependsOn: [
cm_servicebus_cm0c420d2f21084cd_role
]
}
resource cm_servicebus_cm0c420d2f21084cd_role 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(cm_servicebus.id, cm_identity.id, subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '69a216fc-b8fb-44d8-bc22-1f3c2cd27a39'))
properties: {
principalId: cm_identity.properties.principalId
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '69a216fc-b8fb-44d8-bc22-1f3c2cd27a39')
principalType: 'ServicePrincipal'
}
scope: cm_servicebus
}
output cm_managed_identity_id string = cm_identity.id