-
Notifications
You must be signed in to change notification settings - Fork 272
Expand file tree
/
Copy pathdeploy_foundry_role_assignment.bicep
More file actions
63 lines (58 loc) · 1.78 KB
/
Copy pathdeploy_foundry_role_assignment.bicep
File metadata and controls
63 lines (58 loc) · 1.78 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
param principalId string = ''
param roleDefinitionId string
param roleAssignmentName string = ''
param aiServicesName string
param aiProjectName string = ''
param aiLocation string=''
param aiKind string=''
param aiSkuName string=''
param enableSystemAssignedIdentity bool = true
param customSubDomainName string = ''
param publicNetworkAccess string = ''
param defaultNetworkAction string
param vnetRules array = []
param ipRules array = []
// AI Services with Identity (enabled only if flag is true)
resource aiServices 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = if (enableSystemAssignedIdentity) {
name: aiServicesName
location: aiLocation
kind: aiKind
sku: {
name: aiSkuName
}
identity: {
type: 'SystemAssigned'
}
properties: {
allowProjectManagement: true
customSubDomainName: customSubDomainName
networkAcls: {
defaultAction: defaultNetworkAction
virtualNetworkRules: vnetRules
ipRules: ipRules
}
publicNetworkAccess: publicNetworkAccess
}
}
// AI Project with Identity (only if name provided and flag is true)
resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = if (!empty(aiProjectName) && enableSystemAssignedIdentity) {
name: aiProjectName
parent: aiServices
location: aiLocation
identity: {
type: 'SystemAssigned'
}
properties: {}
}
// Role Assignment to AI Services
resource roleAssignmentToFoundry 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: roleAssignmentName
scope: aiServices
properties: {
roleDefinitionId: roleDefinitionId
principalId: principalId
}
}
// Outputs
output aiServicesPrincipalId string = aiServices.identity.principalId
output aiProjectPrincipalId string = !empty(aiProjectName) ? aiProject.identity.principalId : ''