-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathhub.bicep
124 lines (115 loc) · 4 KB
/
hub.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
@description('The AI Studio Hub Resource name')
param name string
@description('The display name of the AI Studio Hub Resource')
param displayName string = name
@description('The storage account ID to use for the AI Studio Hub Resource')
param storageAccountId string
@description('The key vault ID to use for the AI Studio Hub Resource')
param keyVaultId string
@description('The application insights ID to use for the AI Studio Hub Resource')
param applicationInsightsId string = ''
@description('The container registry ID to use for the AI Studio Hub Resource')
param containerRegistryId string = ''
@description('The OpenAI Cognitive Services account name to use for the AI Studio Hub Resource')
param openAiName string
@description('The OpenAI Cognitive Services account connection name to use for the AI Studio Hub Resource')
param openAiConnectionName string
@description('The Azure Cognitive Search service name to use for the AI Studio Hub Resource')
param aiSearchName string = ''
@description('The Azure Cognitive Search service connection name to use for the AI Studio Hub Resource')
param aiSearchConnectionName string
@description('The OpenAI Content Safety connection name to use for the AI Studio Hub Resource')
param openAiContentSafetyConnectionName string
@description('The SKU name to use for the AI Studio Hub Resource')
param skuName string = 'Basic'
@description('The SKU tier to use for the AI Studio Hub Resource')
@allowed(['Basic', 'Free', 'Premium', 'Standard'])
param skuTier string = 'Basic'
@description('The public network access setting to use for the AI Studio Hub Resource')
@allowed(['Enabled','Disabled'])
param publicNetworkAccess string = 'Enabled'
param location string = resourceGroup().location
param tags object = {}
resource hub 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' = {
name: name
location: location
tags: tags
sku: {
name: skuName
tier: skuTier
}
kind: 'Hub'
identity: {
type: 'SystemAssigned'
}
properties: {
friendlyName: displayName
storageAccount: storageAccountId
keyVault: keyVaultId
applicationInsights: !empty(applicationInsightsId) ? applicationInsightsId : null
containerRegistry: !empty(containerRegistryId) ? containerRegistryId : null
hbiWorkspace: false
managedNetwork: {
isolationMode: 'Disabled'
}
v1LegacyMode: false
publicNetworkAccess: publicNetworkAccess
}
resource openAiConnection 'connections' = {
name: openAiConnectionName
properties: {
category: 'AzureOpenAI'
authType: 'ApiKey'
isSharedToAll: true
target: openAi.properties.endpoints['OpenAI Language Model Instance API']
metadata: {
ApiVersion: '2023-07-01-preview'
ApiType: 'azure'
ResourceId: openAi.id
}
credentials: {
key: openAi.listKeys().key1
}
}
}
resource contentSafetyConnection 'connections' = {
name: openAiContentSafetyConnectionName
properties: {
category: 'AzureOpenAI'
authType: 'ApiKey'
isSharedToAll: true
target: openAi.properties.endpoints['Content Safety']
metadata: {
ApiVersion: '2023-07-01-preview'
ApiType: 'azure'
ResourceId: openAi.id
}
credentials: {
key: openAi.listKeys().key1
}
}
}
resource searchConnection 'connections' =
if (!empty(aiSearchName)) {
name: aiSearchConnectionName
properties: {
category: 'CognitiveSearch'
authType: 'ApiKey'
isSharedToAll: true
target: 'https://${search.name}.search.windows.net/'
credentials: {
key: !empty(aiSearchName) ? search.listAdminKeys().primaryKey : ''
}
}
}
}
resource openAi 'Microsoft.CognitiveServices/accounts@2023-05-01' existing = {
name: openAiName
}
resource search 'Microsoft.Search/searchServices@2021-04-01-preview' existing =
if (!empty(aiSearchName)) {
name: aiSearchName
}
output name string = hub.name
output id string = hub.id
output principalId string = hub.identity.principalId