diff --git a/.env.sample b/.env.sample index 0757696f8..a6cc39e38 100644 --- a/.env.sample +++ b/.env.sample @@ -49,4 +49,5 @@ ORCHESTRATION_STRATEGY=openai_functions #Speech-to-text feature AZURE_SPEECH_SERVICE_KEY= AZURE_SPEECH_SERVICE_REGION= -AZURE_AUTH_TYPE=rbac \ No newline at end of file +AZURE_AUTH_TYPE=rbac +AZURE_CONTAINER_REGISTRY_NAME= \ No newline at end of file diff --git a/infra/core/acr.bicep b/infra/core/acr.bicep new file mode 100644 index 000000000..fbe56e089 --- /dev/null +++ b/infra/core/acr.bicep @@ -0,0 +1,24 @@ +@minLength(5) +@maxLength(50) +@description('Provide a globally unique name of your Azure Container Registry') +param acrName string = 'acr${uniqueString(resourceGroup().id)}' + +@description('Provide a location for the registry.') +param location string = resourceGroup().location + +@description('Provide a tier of your Azure Container Registry.') +param acrSku string = 'Basic' + +resource acrResource 'Microsoft.ContainerRegistry/registries@2023-01-01-preview' = { + name: acrName + location: location + sku: { + name: acrSku + } + properties: { + adminUserEnabled: true + } +} + +@description('Output the login server property for later use') +output loginServer string = acrResource.properties.loginServer diff --git a/infra/deployment.bicep b/infra/deployment.bicep index 396e0aad4..2c71d8726 100644 --- a/infra/deployment.bicep +++ b/infra/deployment.bicep @@ -145,6 +145,10 @@ param SpeechServiceName string = '${ResourcePrefix}-speechservice' @description('Azure Content Safety Name') param ContentSafetyName string = '${ResourcePrefix}-contentsafety' + +@description('Azure Container Registry Name') +param RegistryName string = '${ResourcePrefix}acr' + param newGuidString string = newGuid() @allowed([ @@ -906,3 +910,12 @@ module searchIndexDataContUser 'security/role.bicep' = if (authType == 'rbac' && principalType: 'User' } } + +module containerRegistry 'core/acr.bicep' = { + name: RegistryName + scope: resourceGroup() + params: { + acrName: RegistryName + location: Location + } +} diff --git a/infra/deployment.json b/infra/deployment.json index f805e8c94..36e9a7a24 100644 --- a/infra/deployment.json +++ b/infra/deployment.json @@ -5,7 +5,7 @@ "_generator": { "name": "bicep", "version": "0.24.24.22086", - "templateHash": "8362420292927365599" + "templateHash": "16647406633385922905" } }, "parameters": { @@ -319,6 +319,13 @@ "description": "Azure Content Safety Name" } }, + "RegistryName": { + "type": "string", + "defaultValue": "[format('{0}acr', parameters('ResourcePrefix'))]", + "metadata": { + "description": "Azure Container Registry Name" + } + }, "newGuidString": { "type": "string", "defaultValue": "[newGuid()]" @@ -2924,6 +2931,84 @@ ] } } + }, + { + "type": "Microsoft.Resources/deployments", + "apiVersion": "2022-09-01", + "name": "[parameters('RegistryName')]", + "properties": { + "expressionEvaluationOptions": { + "scope": "inner" + }, + "mode": "Incremental", + "parameters": { + "acrName": { + "value": "[parameters('RegistryName')]" + }, + "location": { + "value": "[parameters('Location')]" + } + }, + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.24.24.22086", + "templateHash": "2164522214636164829" + } + }, + "parameters": { + "acrName": { + "type": "string", + "defaultValue": "[format('acr{0}', uniqueString(resourceGroup().id))]", + "minLength": 5, + "maxLength": 50, + "metadata": { + "description": "Provide a globally unique name of your Azure Container Registry" + } + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Provide a location for the registry." + } + }, + "acrSku": { + "type": "string", + "defaultValue": "Basic", + "metadata": { + "description": "Provide a tier of your Azure Container Registry." + } + } + }, + "resources": [ + { + "type": "Microsoft.ContainerRegistry/registries", + "apiVersion": "2023-01-01-preview", + "name": "[parameters('acrName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('acrSku')]" + }, + "properties": { + "adminUserEnabled": true + } + } + ], + "outputs": { + "loginServer": { + "type": "string", + "metadata": { + "description": "Output the login server property for later use" + }, + "value": "[reference(resourceId('Microsoft.ContainerRegistry/registries', parameters('acrName')), '2023-01-01-preview').loginServer]" + } + } + } + } } ] } \ No newline at end of file