Skip to content

Commit 5c9603b

Browse files
authored
Merge pull request #50 from greenie-msft/bicep-cleanup
Add DTS bicep w/ roles and env vars in the function app. Also remove AI Foundry deps and only use Azure OpenAI
2 parents 03ae557 + 157e3cf commit 5c9603b

File tree

11 files changed

+141
-205
lines changed

11 files changed

+141
-205
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ appsettings.json
4242
.env
4343
.env.local
4444
.env.*.local
45+
.azure/
4546

4647
__azurite_db_blob__.json
4748

infra/abbreviations.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,7 @@
131131
"webSitesAppService": "app-",
132132
"webSitesAppServiceEnvironment": "ase-",
133133
"webSitesFunctions": "func-",
134-
"webStaticSites": "stapp-"
134+
"webStaticSites": "stapp-",
135+
"dts": "dts-",
136+
"taskhub": "taskhub-"
135137
}

infra/app/ai/ai-project.bicep

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

infra/app/ai/cognitive-services.bicep

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ resource aiServices 'Microsoft.CognitiveServices/accounts@2025-04-01-preview' =
4545
properties: {
4646
customSubDomainName: toLower(aiServicesName)
4747
publicNetworkAccess: 'Enabled'
48+
disableLocalAuth: true
4849
}
4950
}
5051

@@ -86,7 +87,4 @@ output aiServicesId string = aiServices.id
8687
output aiServicesEndpoint string = aiServices.properties.endpoint
8788
output azureOpenAIServiceEndpoint string = 'https://${aiServices.properties.customSubDomainName}.openai.azure.com/'
8889
output embeddingDeploymentName string = embeddingModelDeployment.name
89-
output chatDeploymentName string = chatModelDeployment.name
90-
@description('Primary key for the AI Services account.')
91-
@secure()
92-
output primaryKey string = aiServices.listKeys().key1
90+
output chatDeploymentName string = chatModelDeployment.name

infra/app/api.bicep

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ param instanceMemoryMB int = 2048
1111
param maximumInstanceCount int = 100
1212
param identityId string = ''
1313
param identityClientId string = ''
14-
param aiServicesId string
1514
param resourceToken string
1615

1716
param runtimeName string = 'python'
@@ -93,7 +92,6 @@ module api 'br/public:avm/res/web/site:0.15.1' = {
9392
APPLICATIONINSIGHTS_CONNECTION_STRING: applicationInsights.properties.ConnectionString
9493
APPLICATIONINSIGHTS_AUTHENTICATION_STRING: applicationInsightsIdentity
9594
AzureWebJobsFeatureFlags: 'EnableWorkerIndexing'
96-
AZURE_OPENAI_KEY: listKeys(aiServicesId, '2025-04-01-preview').key1
9795
PYTHON_ENABLE_WORKER_EXTENSIONS: '1'
9896
})
9997
virtualNetworkSubnetId: !empty(virtualNetworkSubnetId) ? virtualNetworkSubnetId : null

infra/app/cosmos-db.bicep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ resource account 'Microsoft.DocumentDB/databaseAccounts@2023-11-15' = {
2222
kind: 'GlobalDocumentDB'
2323
properties: {
2424
databaseAccountOfferType: 'Standard'
25+
disableLocalAuth: true
2526
capabilities: [
2627
{ name: 'EnableServerless' }
2728
{ name: 'EnableNoSQLVectorSearch' }

infra/app/dts.bicep

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
param ipAllowlist array
2+
param location string
3+
param tags object = {}
4+
param name string
5+
param taskhubname string
6+
param skuName string
7+
param skuCapacity int
8+
9+
resource dts 'Microsoft.DurableTask/schedulers@2025-11-01' = {
10+
location: location
11+
tags: tags
12+
name: name
13+
properties: {
14+
ipAllowlist: ipAllowlist
15+
sku: {
16+
name: skuName
17+
capacity: skuCapacity
18+
}
19+
}
20+
}
21+
22+
resource taskhub 'Microsoft.DurableTask/schedulers/taskhubs@2025-11-01' = {
23+
parent: dts
24+
name: taskhubname
25+
}
26+
27+
output dts_NAME string = dts.name
28+
output dts_URL string = dts.properties.endpoint
29+
output TASKHUB_NAME string = taskhub.name

infra/app/rbac/dts-access.bicep

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
param principalID string
2+
param roleDefinitionID string
3+
param dtsName string
4+
param principalType string
5+
6+
resource dts 'Microsoft.DurableTask/schedulers@2024-10-01-preview' existing = {
7+
name: dtsName
8+
}
9+
10+
resource dtsRoleAssignment 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
11+
name: guid(dts.id, principalID, roleDefinitionID )
12+
scope: dts
13+
properties: {
14+
roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', roleDefinitionID )
15+
principalId: principalID
16+
principalType: principalType
17+
}
18+
}

infra/app/rbac/openai-access.bicep

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@description('The name of the Azure OpenAI account')
2+
param openAIAccountName string
3+
4+
@description('The role definition ID for the role assignment')
5+
param roleDefinitionId string
6+
7+
@description('The principal ID to assign the role to')
8+
param principalId string
9+
10+
resource openAIAccount 'Microsoft.CognitiveServices/accounts@2023-05-01' existing = {
11+
name: openAIAccountName
12+
}
13+
14+
resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
15+
name: guid(openAIAccount.id, principalId, roleDefinitionId)
16+
scope: openAIAccount
17+
properties: {
18+
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', roleDefinitionId)
19+
principalId: principalId
20+
principalType: 'ServicePrincipal'
21+
}
22+
}

0 commit comments

Comments
 (0)