-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Azure OpenAI setup by moving to Bicep module.
- Loading branch information
1 parent
4f4f7a1
commit 9d8a76e
Showing
3 changed files
with
84 additions
and
44 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
metadata description = 'Creates an Azure Cognitive Services instance.' | ||
param name string | ||
param location string = resourceGroup().location | ||
param tags object = {} | ||
@description('The custom subdomain name used to access the API. Defaults to the value of the name parameter.') | ||
param customSubDomainName string = name | ||
param disableLocalAuth bool = false | ||
param deployments array = [] | ||
param kind string = 'OpenAI' | ||
|
||
@allowed([ 'Enabled', 'Disabled' ]) | ||
param publicNetworkAccess string = 'Enabled' | ||
param sku object = { | ||
name: 'S0' | ||
} | ||
|
||
param allowedIpRules array = [] | ||
param networkAcls object = empty(allowedIpRules) ? { | ||
defaultAction: 'Allow' | ||
} : { | ||
ipRules: allowedIpRules | ||
defaultAction: 'Deny' | ||
} | ||
|
||
resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = { | ||
name: name | ||
location: location | ||
tags: tags | ||
kind: kind | ||
properties: { | ||
customSubDomainName: customSubDomainName | ||
publicNetworkAccess: publicNetworkAccess | ||
networkAcls: networkAcls | ||
disableLocalAuth: disableLocalAuth | ||
} | ||
sku: sku | ||
} | ||
|
||
@batchSize(1) | ||
resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = [for deployment in deployments: { | ||
parent: account | ||
name: deployment.name | ||
properties: { | ||
model: { | ||
format: 'OpenAI' | ||
name: deployment.model.name | ||
version: deployment.model.version | ||
} | ||
} | ||
sku: contains(deployment, 'sku') ? deployment.sku : { | ||
name: 'Standard' | ||
capacity: 20 | ||
} | ||
}] | ||
|
||
output endpoint string = account.properties.endpoint | ||
output key string = listKeys(account.id, '2023-05-01').key1 | ||
output id string = account.id | ||
output name string = account.name |