-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.bicep
More file actions
54 lines (44 loc) · 1.86 KB
/
main.bicep
File metadata and controls
54 lines (44 loc) · 1.86 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
targetScope='subscription'
// The main bicep module to provision Azure resources.
// For a more complete walkthrough to understand how this file works with azd,
// see https://learn.microsoft.com/azure/developer/azure-developer-cli/make-azd-compatible?pivots=azd-create
var abbrs = loadJsonContent('./abbreviations.json')
// Optional parameters to override the default azd resource naming conventions.
// Add the following to main.parameters.json to provide values:
// "resourceGroupName": {
// "value": "myGroupName"
// }
param resourceGroupName string = ''
param azureOpenAIServiceName string = ''
@minLength(1)
@maxLength(64)
@description('Name of the environment which is used to generate a short, unique hash used in all resources.')
// For an overview on this and other key Azure concepts,
// see https://learn.microsoft.com/azure/deployment-environments/concept-environments-key-concepts#environments
param environmentName string
// tags that will be applied to all resources.
var tags = {
// Tag all resources with the environment name.
'azd-env-name': environmentName
}
@description('Location of all resources')
param location string
// Generate a unique token to be used in naming resources.
// Remove linter suppression after using.
#disable-next-line no-unused-vars
var resourceToken = toLower(uniqueString(subscription().id, environmentName, location))
// Resources are organized in a resource group
resource rg 'Microsoft.Resources/resourceGroups@2022-09-01' = {
name: !empty(resourceGroupName) ? resourceGroupName : '${abbrs.resourcesResourceGroups}${environmentName}'
location: location
tags: tags
}
module azureOpenAi 'ai.bicep' = {
name: 'azureOpenAi'
params: {
name: !empty(azureOpenAIServiceName) ? azureOpenAIServiceName : 'aoai-${resourceToken}'
location: location
}
scope: rg
}
output AZURE_OPENAI_ENDPOINT string = azureOpenAi.outputs.endpoint