-
Notifications
You must be signed in to change notification settings - Fork 0
Add bicep files for Azure OpenAI resource provisioning #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
brandom-msft
wants to merge
9
commits into
main
Choose a base branch
from
brandom/bicep
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
40ac1e2
Add bicep files for Azure OpenAI resource provisioning
brandom-msft 3031f8d
Update Azure OpenAI resource endpoint outputs in bicep files
brandom-msft 13e3727
Merge branch 'main' into brandom/bicep
brandom-msft 18a770c
simplifying ai bicep setup
brandom-msft c1532f4
additional output vars from main
brandom-msft 8f780eb
update var usage
brandom-msft 90edba4
add azd support to devcontainer
brandom-msft 3dac788
Merge branch 'brandom/bicep' of https://github.com/glecaros/chat-prot…
brandom-msft 678208d
add docker-in-docker for azd
brandom-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,4 @@ | ||
| { | ||
| "keyVaultVaults": "kv-", | ||
| "resourcesResourceGroups": "rg-" | ||
| } |
This file contains hidden or 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,50 @@ | ||
| param name string | ||
| param location string | ||
| param deployments array = [ | ||
| { | ||
| name: 'chat' | ||
| model: { | ||
| format: 'OpenAI' | ||
| name: 'gpt-4' | ||
| version: '0613' | ||
| } | ||
| sku: { | ||
| capacity: 1000 | ||
| } | ||
| } | ||
| ] | ||
|
|
||
| @description('') | ||
| resource azureOpenAiResource 'Microsoft.CognitiveServices/accounts@2023-10-01-preview' = { | ||
| name: name | ||
| location: location | ||
| sku: { | ||
| name: 'S0' | ||
| } | ||
| kind: 'OpenAI' | ||
| tags: {} | ||
| properties: { | ||
| // customSubDomainName: needed? | ||
| networkAcls: { | ||
| defaultAction: 'Allow' | ||
| virtualNetworkRules: [] | ||
| ipRules: [] | ||
| } | ||
| publicNetworkAccess: 'Enabled' | ||
| } | ||
| } | ||
|
|
||
| resource modelDeployments 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = [for item in deployments: { | ||
| parent: azureOpenAiResource | ||
| name: item.name | ||
| sku: (contains(item, 'sku') ? item.sku : { | ||
| name: 'Standard' | ||
| capacity: item.capacity | ||
| }) | ||
| properties: { | ||
| model: item.model | ||
| raiPolicyName: (contains(item, 'raiPolicyName') ? item.raiPolicyName : null) | ||
| } | ||
| }] | ||
|
|
||
| output endpoint string = azureOpenAiResource.properties.endpoint |
This file contains hidden or 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,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: | ||
brandom-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // "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 | ||
This file contains hidden or 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,18 @@ | ||
| { | ||
| "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", | ||
| "contentVersion": "1.0.0.0", | ||
| "parameters": { | ||
| "environmentName": { | ||
brandom-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "value": "${AZURE_ENV_NAME}" | ||
| }, | ||
| "location": { | ||
| "value": "${AZURE_LOCATION}" | ||
| }, | ||
| "resourceGroupName": { | ||
| "value": "${AZURE_RESOURCE_GROUP}" | ||
| }, | ||
| "openAiServiceName": { | ||
| "value": "${AZURE_OPENAI_SERVICE}" | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: rename "bicep" directory to "infra", align with azd standard