Created
July 2, 2024 19:16
-
-
Save pamelafox/59be876da519d05b831549ebfea44a4a to your computer and use it in GitHub Desktop.
Phi3 deployment with Bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param location string | |
param aiHubName string | |
param aiProjectName string | |
param modelName string | |
param modelVersion string | |
param deploymentName string | |
param tags object = {} | |
param publicNetworkAccess string | |
param aiServicesName string | |
param storageName string | |
param keyVaultName string | |
param containerRegistryName string | |
param applicationInsightsName string | |
param searchName string = '' | |
resource aiServices 'Microsoft.CognitiveServices/accounts@2023-05-01' existing = { | |
name: aiServicesName | |
} | |
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = { | |
name: applicationInsightsName | |
location: location | |
tags: tags | |
kind: 'web' | |
properties: { | |
Application_Type: 'web' | |
DisableIpMasking: false | |
DisableLocalAuth: false | |
Flow_Type: 'Bluefield' | |
ForceCustomerStorageForProfiler: false | |
ImmediatePurgeDataOn30Days: true | |
IngestionMode: 'ApplicationInsights' | |
publicNetworkAccessForIngestion: publicNetworkAccess | |
publicNetworkAccessForQuery: publicNetworkAccess | |
Request_Source: 'rest' | |
} | |
} | |
resource containerRegistry 'Microsoft.ContainerRegistry/registries@2023-07-01' existing = { | |
name: containerRegistryName | |
} | |
resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' existing = { | |
name: keyVaultName | |
} | |
resource storage 'Microsoft.Storage/storageAccounts@2023-05-01' existing = { | |
name: storageName | |
} | |
resource search 'Microsoft.Search/searchServices@2023-11-01' existing = if (!empty(searchName)) { | |
name: searchName | |
} | |
resource aiHub 'Microsoft.MachineLearningServices/workspaces@2024-04-01-preview' = { | |
name: aiHubName | |
location: location | |
tags: tags | |
identity: { | |
type: 'SystemAssigned' | |
} | |
properties: { | |
publicNetworkAccess: publicNetworkAccess | |
managedNetwork: { | |
isolationMode: 'AllowInternetOutbound' | |
outboundRules: { | |
'rule-${search.name}': { | |
type: 'PrivateEndpoint' | |
destination: { | |
serviceResourceId: search.id | |
subresourceTarget: 'searchService' | |
} | |
} | |
} | |
} | |
friendlyName: aiHubName | |
applicationInsights: applicationInsights.id | |
containerRegistry: containerRegistry.id | |
keyVault: keyVault.id | |
storageAccount: storage.id | |
systemDatastoresAuthMode: 'identity' | |
} | |
kind: 'hub' | |
resource aiServicesConnection 'connections@2024-04-01' = { | |
name: '${aiHubName}-connection-AIServices' | |
properties: { | |
category: 'AIServices' | |
target: aiServices.properties.endpoint | |
authType: 'ApiKey' | |
isSharedToAll: true | |
credentials: { | |
key: aiServices.listKeys().key1 | |
} | |
metadata: { | |
ApiType: 'Azure' | |
ResourceId: aiServices.id | |
ApiVersion: '2023-07-01-preview' | |
DeploymentApiVersion: '2023-10-01-preview' | |
Location: location | |
} | |
} | |
} | |
resource searchConnection 'connections@2024-04-01' = if (!empty(searchName)) { | |
name: '${aiHubName}-connection-Search' | |
properties: { | |
category: 'CognitiveSearch' | |
target: 'https://${search.name}.search.windows.net' | |
authType: 'ApiKey' | |
isSharedToAll: true | |
credentials: { | |
key: search.listAdminKeys().primaryKey | |
} | |
} | |
} | |
} | |
resource aiProject 'Microsoft.MachineLearningServices/workspaces@2024-04-01-preview' = { | |
name: aiProjectName | |
location: location | |
tags: tags | |
identity: { | |
type: 'SystemAssigned' | |
} | |
properties: { | |
publicNetworkAccess: publicNetworkAccess | |
hubResourceId: aiHub.id | |
} | |
kind: 'Project' | |
} | |
resource phiDeployment 'Microsoft.MachineLearningServices/workspaces/serverlessEndpoints@2024-04-01' = if (startsWith(modelName, 'phi')) { | |
name: deploymentName | |
location: location | |
parent: aiProject | |
sku: { | |
name: 'Consumption' | |
} | |
properties: { | |
authMode: 'Key' | |
modelSettings: { | |
modelId: 'azureml://registries/azureml/models/${modelName}-${modelVersion}' | |
} | |
contentSafety: { | |
contentSafetyStatus: 'Enabled' | |
} | |
} | |
} | |
output aiServicesID string = aiServices.id | |
output aiServicesName string = aiServices.name | |
output aiServicesEndpoint string = aiServices.properties.endpoint | |
output aiHubID string = aiHub.id | |
output aiHubName string = aiHub.name | |
output aiProjectID string = aiProject.id | |
output aiProjectName string = aiProject.name | |
output deploymentName string = deploymentName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment