Skip to content

Commit dc7ab7b

Browse files
authored
Merge pull request #43 from azure-ai-foundry/feature/infra-templates
Add connections bicep samples
2 parents 8a541bd + 81edd5d commit dc7ab7b

File tree

22 files changed

+286
-174
lines changed

22 files changed

+286
-174
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,3 +399,4 @@ FodyWeavers.xsd
399399

400400
# JetBrains Rider
401401
*.sln.iml
402+
use-cases/infrastructure-setup/01-connections/your.deployment.parameters.json

use-cases/infrastructure-as-code/01-connections/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

use-cases/infrastructure-as-code/01-connections/application-insights.bicep

Lines changed: 0 additions & 44 deletions
This file was deleted.

use-cases/infrastructure-as-code/10-private-network/deploy.json

Lines changed: 0 additions & 45 deletions
This file was deleted.

use-cases/infrastructure-as-code/20-user-assigned-identity/azuredeploy.parameters.json

Lines changed: 0 additions & 27 deletions
This file was deleted.
File renamed without changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Connections Bicep Examples
2+
3+
Connections enable your AI applications to access tools and objects managed elsewhere in or outside of Azure.
4+
5+
This folder provides a set of examples for the most common connection categories.

use-cases/infrastructure-as-code/01-connections/ai-search.bicep renamed to use-cases/infrastructure-setup/01-connections/connection-ai-search.bicep

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,50 @@
11
/*
2+
Connections enable your AI applications to access tools and objects managed elsewhere in or outside of Azure.
3+
24
This example demonstrates how to add an Azure AI Search connection.
35
*/
4-
param aiFoundryName string = 'your-account'
5-
param aiSearchName string = 'ais-${aiFoundryName}'
6+
param aiFoundryName string = '<your-account-name>'
7+
param connectedResourceName string = 'ais-${aiFoundryName}'
8+
param location string = 'westus'
69

7-
// whether ai Search is existing or new
10+
// Whether to create a new Azure AI Search resource
811
@allowed([
912
'new'
1013
'existing'
1114
])
1215
param newOrExisting string = 'new'
1316

14-
#disable-next-line BCP081
17+
// Refers your existing Azure AI Foundry resource
1518
resource aiFoundry 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' existing = {
1619
name: aiFoundryName
1720
scope: resourceGroup()
1821
}
1922

23+
// Conditionally refers your existing Azure AI Search resource
2024
resource existingSearchService 'Microsoft.Search/searchServices@2025-02-01-preview' existing = if (newOrExisting == 'existing') {
21-
name: aiSearchName
25+
name: connectedResourceName
2226
}
2327

28+
// Conditionally creates a new Azure AI Search resource
2429
resource newSearchService 'Microsoft.Search/searchServices@2025-02-01-preview' = if (newOrExisting == 'new') {
25-
name: aiSearchName
26-
location: 'westus'
30+
name: connectedResourceName
31+
location: location
2732
sku: {
2833
name: 'basic'
2934
}
3035
properties: {}
3136
}
3237

33-
resource project_connection_azureai_search 'Microsoft.CognitiveServices/accounts/connections@2025-04-01-preview' = {
34-
name: aiSearchName
38+
// Creates the Azure Foundry connection to your Azure AI Search resource
39+
resource connection 'Microsoft.CognitiveServices/accounts/connections@2025-04-01-preview' = {
40+
name: '${aiFoundryName}-aisearch'
3541
parent: aiFoundry
3642
properties: {
3743
category: 'CognitiveSearch'
3844
target: ((newOrExisting == 'new') ? newSearchService.properties.endpoint : existingSearchService.properties.endpoint)
39-
authType: 'ApiKey'
40-
isSharedToAll: true
45+
authType: 'ApiKey' // Supported auth types: ApiKey, AAD
4146
credentials: {
42-
key: ((newOrExisting == 'new') ? listKeys(newSearchService.id, '2020-06-10').key1 : listKeys(existingSearchService.id, '2020-06-10').key1)
47+
key: ((newOrExisting == 'new') ? newSearchService.listAdminKeys().primaryKey : existingSearchService.listAdminKeys().primaryKey)
4348
}
4449
metadata: {
4550
ApiType: 'Azure'

0 commit comments

Comments
 (0)