-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmain.bicep
More file actions
143 lines (112 loc) · 3.5 KB
/
main.bicep
File metadata and controls
143 lines (112 loc) · 3.5 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
targetScope = 'local'
extension azuredevops
@description('Azure DevOps organization name (short org slug, not full URL).')
param organization string
@description('Project name')
param projectName string
@description('Optional project description')
param projectDescription string = ''
@allowed([
'Private'
'Public'
])
param visibility string = 'Private'
@description('Process name (Agile, Scrum, Basic, CMMI)')
param processName string = 'Agile'
@allowed([
'Git'
'Tfvc'
])
param sourceControl string = 'Git'
@description('Repository name')
param repositoryName string
@description('Artifact feed name')
param artifactName string
@description('Entra ID group objectId (GUID) to assign to the project role')
param entraGroupObjectId string?
@description('Project role to grant to the Entra group')
param azureDevOpsRole string?
@description('Client ID of the service principal')
param clientId string
@description('Subscription ID')
param subscriptionId string
@description('Subscription name')
param subscriptionName string
@description('Tenant ID')
param tenantId string
@description('List of Azure DevOps extensions to install')
param extensions extensionType[]
@description('List of work items to create')
param workItems workItemType[]
resource project 'AzureDevOpsProject' = {
name: projectName
organization: organization
description: empty(projectDescription) ? null : projectDescription
visibility: visibility
processName: processName
sourceControlType: sourceControl
}
resource extension 'AzureDevOpsExtension' = [for ext in extensions: {
organization: organization
publisherName: ext.publisherName
extensionName: ext.extensionName
version: ext.version
}]
resource repository 'AzureDevOpsRepository' = {
name: repositoryName
organization: organization
project: project.name
}
resource artifactFeed 'AzureDevOpsArtifactFeed' = {
name: artifactName
organization: organization
project: project.name
}
resource workItemList 'AzureDevOpsWorkItem' = [for workItem in workItems: {
project: project.name
organization: organization
id: workItem.id
title: workItem.title
description: workItem.?description
type: workItem.type
}]
resource readerPermission 'AzureDevOpsPermission' = if (!empty(entraGroupObjectId) && !empty(azureDevOpsRole)) {
groupObjectId: entraGroupObjectId!
organization: organization
project: project.name
role: azureDevOpsRole!
}
resource serviceConnection 'AzureDevOpsServiceConnection' = {
name: 'my-first-service-connection'
organization: organization
project: project.name
grantAllPipelines: true
description: 'Service connection for Azure resources created by Bicep'
clientId: clientId
subscriptionId: subscriptionId
subscriptionName: subscriptionName
tenantId: tenantId
}
// Outputs
output projectId string = project.projectId
output projectState string = project.state
output projectUrl string = project.url
output repositoryId string = repository.repositoryId
output repositoryWebUrl string = repository.webUrl
output repositoryRemoteUrl string = repository.remoteUrl
output repositorySshUrl string = repository.sshUrl
output artifactFeedId string = artifactFeed.feedId
output artifactFeedUrl string = artifactFeed.url
output serviceConnectionIdentifier string = serviceConnection.subjectIdentifier
output serviceConnectionIssuer string = serviceConnection.issuer
type extensionType = {
publisherName: string
extensionName: string
version: string
}
type workItemType = {
id: int
title: string
description: string?
type: string
}