Skip to content

Commit 3eca7e2

Browse files
authored
Merge pull request #7 from azure-ai-foundry/feature/infra-templates
Add initial enterprise configuraiton templates
2 parents 6fc4741 + 578cdde commit 3eca7e2

File tree

8 files changed

+196
-321
lines changed

8 files changed

+196
-321
lines changed

use-cases/infrastructure-as-code/00-basic/azuredeploy.json

Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,61 @@
1-
param aiServicesName string = 'myaiservices123'
2-
param location string = 'East US 2'
3-
param sku string = 'S0'
4-
param aiProjectName string = 'myaiservices123-proj'
1+
param aiFoundryName string = 'resourcename'
2+
param aiProjectName string = '${aiFoundryName}-proj'
3+
param location string = 'westus'
54

6-
resource aiService 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = {
7-
name: aiServicesName
5+
/*
6+
An AI Foundry resources is a variant of a CognitiveServices/account resource type
7+
*/
8+
resource aiFoundry 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = {
9+
name: aiFoundryName
810
location: location
911
identity: {
1012
type: 'SystemAssigned'
1113
}
1214
sku: {
13-
name: sku
15+
name: 'S0'
1416
}
1517
kind: 'AIServices'
1618
properties: {
17-
allowProjectManagement: true
19+
allowProjectManagement: true // required to work in AI Foundry
20+
21+
// Defines developer API endpoint subdomain
22+
customSubDomainName: aiFoundryName
1823
}
1924
}
2025

26+
/*
27+
Developer APIs are exposed via a project, which groups in- and outputs that relate to one use case, including files.
28+
Its advisable to create one project right away, so development teams can directly get started.
29+
Projects may be granted individual RBAC permissions and identities on top of what account provides.
30+
*/
2131
resource aiProject 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = {
2232
name: aiProjectName
23-
parent: aiService
33+
parent: aiFoundry
2434
location: location
2535
identity: {
2636
type: 'SystemAssigned'
2737
}
38+
properties: {
39+
displayName: 'test'
40+
description: 'test2'
41+
isDefault: true
42+
}
43+
}
44+
45+
/*
46+
Optionally deploy a model to use in playground, agents and other tools.
47+
*/
48+
resource modelDeployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01'= {
49+
parent: aiFoundry
50+
name: 'gpt-4o'
51+
sku : {
52+
capacity: 1
53+
name: 'GlobalStandard'
54+
}
55+
properties: {
56+
model:{
57+
name: 'gpt-4o'
58+
format: 'OpenAI'
59+
}
60+
}
2861
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
This example demonstrates how to add an Azure AI Search connection.
3+
*/
4+
param aiFoundryName string = 'your-account'
5+
param aiSearchName string = 'ais-${aiFoundryName}'
6+
7+
// whether ai Search is existing or new
8+
@allowed([
9+
'new'
10+
'existing'
11+
])
12+
param newOrExisting string = 'new'
13+
14+
#disable-next-line BCP081
15+
resource aiFoundry 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' existing = {
16+
name: aiFoundryName
17+
scope: resourceGroup()
18+
}
19+
20+
resource existingSearchService 'Microsoft.Search/searchServices@2025-02-01-preview' existing = if (newOrExisting == 'existing') {
21+
name: aiSearchName
22+
}
23+
24+
resource newSearchService 'Microsoft.Search/searchServices@2025-02-01-preview' = if (newOrExisting == 'new') {
25+
name: aiSearchName
26+
location: 'westus'
27+
sku: {
28+
name: 'basic'
29+
}
30+
properties: {}
31+
}
32+
33+
resource project_connection_azureai_search 'Microsoft.CognitiveServices/accounts/connections@2025-04-01-preview' = {
34+
name: aiSearchName
35+
parent: aiFoundry
36+
properties: {
37+
category: 'CognitiveSearch'
38+
target: ((newOrExisting == 'new') ? newSearchService.properties.endpoint : existingSearchService.properties.endpoint)
39+
authType: 'ApiKey'
40+
isSharedToAll: true
41+
credentials: {
42+
key: ((newOrExisting == 'new') ? listKeys(newSearchService.id, '2020-06-10').key1 : listKeys(existingSearchService.id, '2020-06-10').key1)
43+
}
44+
metadata: {
45+
ApiType: 'Azure'
46+
ResourceId: ((newOrExisting == 'new') ? newSearchService.id : existingSearchService.id)
47+
location: ((newOrExisting == 'new') ? newSearchService.location : existingSearchService.location)
48+
}
49+
}
50+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"accounts_sansinhtest19871_name": {
6+
"defaultValue": "sansinhtest199919",
7+
"type": "String"
8+
}
9+
},
10+
"variables": {},
11+
"resources": [
12+
{
13+
"type": "Microsoft.CognitiveServices/accounts",
14+
"apiVersion": "2024-10-01",
15+
"name": "[parameters('accounts_sansinhtest19871_name')]",
16+
"location": "eastus",
17+
"sku": {
18+
"name": "S0"
19+
},
20+
21+
"kind": "AIServices",
22+
"identity": {
23+
"type": "SystemAssigned"
24+
},
25+
"properties": {
26+
"allowProjectManagement": true,
27+
"customSubDomainName": "[parameters('accounts_sansinhtest19871_name')]",
28+
"networkAcls": {
29+
"defaultAction": "Allow",
30+
"virtualNetworkRules": [],
31+
"ipRules": []
32+
},
33+
"publicNetworkAccess": "Enabled",
34+
"networkInjections":[
35+
{
36+
"scenario": "agent",
37+
"subnetArmId" : "/subscriptions/a9216f37-b90e-4db2-b844-b171e5394fc1/resourceGroups/sansinhtest/providers/Microsoft.Network/virtualNetworks/sansinheert/subnets/default",
38+
"useMicrosoftManagedNetwork": false
39+
}
40+
]
41+
}
42+
43+
}
44+
]
45+
}

use-cases/infrastructure-as-code/20-user-assigned-identity/main.bicep

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,41 @@
22
AI Foundry account and project - with your User-Assigned managed identity.
33
44
Description:
5-
- Create an AI Foundry (previously known as Azure AI Services) account and project with UAI.
6-
- Create a gpt-4o model deployment
7-
- When creating a project, the Identity is not updateable. Please select 'SystemAssigned', 'UserAssigned' or 'SystemAssigned,UserAssigned' during creation as this cannot be updated. .
8-
- Creating your first project is needed to support more capabilities and is the default reoute for APIs if no paramter is provided.
5+
- Creates an AI Foundry (previously known as Azure AI Services) account and project with UAI.
6+
- Creates a gpt-4o model deployment
7+
8+
Known limitations:
9+
- When creating a project, managed identity cannot be updated. Please select 'SystemAssigned', 'UserAssigned' or 'SystemAssigned,UserAssigned' during creation.
910
1011
*/
1112
@description('That name is the name of our application. It has to be unique. Type a name followed by your resource group name. (<name>-<resourceGroupName>)')
12-
param aiServicesName string = 'aiServices-${uniqueString(resourceGroup().id)}'
13+
param aiFoundryName string = 'your-resource'
1314

1415
@description('Location for all resources.')
15-
param location string = resourceGroup().location
16+
param location string = 'eastus'
1617

1718
@description('Name of the first project')
18-
param defaultProjectName string = '${aiServicesName}-proj'
19+
param defaultProjectName string = '${aiFoundryName}-proj'
1920
param defaultProjectDisplayName string = 'Project'
2021
param defaultProjectDescription string = 'Describe what your project is about.'
2122

2223
/*
2324
Step 1: Get your existing/previously created Managed Identity
2425
25-
*/
26-
@description('User Assigned Identity Name')
27-
param userAssignedIdentityName string
26+
*/
2827
@description('User Assigned Identity Resource Group Name')
2928
param userIdentityResourceGroupName string = resourceGroup().name
3029

30+
@description('User Assigned Identity Name')
31+
param userAssignedIdentityName string = 'aifoundry-test-uai'
32+
3133
var userAssignedIdentityId = extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, '${userIdentityResourceGroupName}'), 'Microsoft.ManagedIdentity/userAssignedIdentities', '${userAssignedIdentityName}')
3234

3335
/*
3436
Step 2: Create a Cognitive Services Account
35-
3637
*/
3738
resource account 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = {
38-
name: aiServicesName
39+
name: aiFoundryName
3940
location: location
4041
identity: {
4142
type: 'SystemAssigned,UserAssigned' // Select 'UserAssigned' or 'SystemAssigned,UserAssigned' during creation as this cannot be updated.
@@ -51,19 +52,20 @@ resource account 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' = {
5152
// Networking
5253
publicNetworkAccess: 'Enabled'
5354

54-
// Specifies wheether this resource support project management as child resources, used as containers for access management, data isolation, and cost in AI Foundry.
55+
// Specifies whether this resource support project management as child resources, used as containers for access management, data isolation, and cost in AI Foundry.
5556
allowProjectManagement: true
5657

58+
// Defines developer API endpoint subdomain
59+
customSubDomainName: aiFoundryName
60+
5761
// Auth
58-
disableLocalAuth: true
62+
disableLocalAuth: false
5963
}
6064
}
6165

6266
/*
6367
Step 3: Deploy gpt-4o model
64-
6568
*/
66-
6769
resource modelDeployment 'Microsoft.CognitiveServices/accounts/deployments@2024-10-01'= {
6870
parent: account
6971
name: 'gpt-4o'
@@ -82,7 +84,6 @@ resource modelDeployment 'Microsoft.CognitiveServices/accounts/deployments@2024-
8284

8385
/*
8486
Step 4: Create a Project
85-
8687
*/
8788
resource project 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-preview' = {
8889
name: defaultProjectName
@@ -92,7 +93,7 @@ resource project 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-previ
9293
identity: {
9394
type: 'SystemAssigned,UserAssigned' // Select 'UserAssigned' or 'SystemAssigned,UserAssigned' during creation as this cannot be updated.
9495
userAssignedIdentities: {
95-
'${userAssignedIdentityId}': {}
96+
'${userAssignedIdentityId}': {}
9697
}
9798
}
9899

@@ -103,6 +104,10 @@ resource project 'Microsoft.CognitiveServices/accounts/projects@2025-04-01-previ
103104
}
104105
}
105106

107+
/* Step 5:
108+
Grant managed identity 'Azure AI Administrator' role on account
109+
*/
110+
106111
output accountId string = account.id
107112
output accountName string = account.name
108113
output project string = project.name

0 commit comments

Comments
 (0)