Skip to content

Commit 3fdf7f1

Browse files
ferantiverockittel
andauthored
feat (infra): [aifoundry] add resource locks for AI Foundry Project Capability Host dependencies (#73)
Co-authored-by: Chad Kittel <chad.kittel@gmail.com>
1 parent 1150f82 commit 3fdf7f1

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,14 @@ Most Azure resources deployed in the prior steps will incur ongoing charges unle
346346
347347
Additionally, a few of the resources deployed enter soft delete status which will restrict the ability to redeploy another resource with the same name or DNS entry; and might not release quota. It's best to purge any soft deleted resources once you are done exploring. Use the following commands to delete the deployed resources and resource group and to purge each of the resources with soft delete.
348348

349+
1. Delete the resource level locks for AI Foundry Project Capability Host dependencies
350+
351+
```bash
352+
az lock delete -g $RESOURCE_GROUP --resource-type 'Microsoft.Storage/storageAccounts' --resource stagent${BASE_NAME} -n stagent${BASE_NAME}-lock
353+
az lock delete -g $RESOURCE_GROUP --resource-type 'Microsoft.DocumentDB/databaseAccounts' --resource cdb-ai-agent-threads-${BASE_NAME} -n cdb-ai-agent-threads-${BASE_NAME}-lock
354+
az lock delete -g $RESOURCE_GROUP --resource-type 'Microsoft.Search/searchServices' --resource ais-ai-agent-vector-store-${BASE_NAME} -n ais-ai-agent-vector-store-${BASE_NAME}-lock
355+
```
356+
349357
1. Delete the resource group as a way to delete all contained Azure resources.
350358

351359
| :warning: | This will completely delete any data you may have included in this example. That data and this deployment will be unrecoverable. |

infra-as-code/bicep/ai-agent-blob-storage.bicep

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,18 @@ resource azureDiagnostics 'Microsoft.Insights/diagnosticSettings@2021-05-01-prev
171171
}
172172
}
173173

174+
// Prevent Accidental Changes
175+
176+
resource agentStorageAccountLocks 'Microsoft.Authorization/locks@2020-05-01' = {
177+
scope: agentStorageAccount
178+
name: '${agentStorageAccount.name}-lock'
179+
properties: {
180+
level: 'CanNotDelete'
181+
notes: 'Prevent deleting; recovery not practical. Hard dependency for your AI Foundry Agent Service.'
182+
owners: []
183+
}
184+
}
185+
174186
// ---- Outputs ----
175187

176188
output storageAccountName string = agentStorageAccount.name

infra-as-code/bicep/ai-search.bicep

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ resource aiSearchPrivateEndpoint 'Microsoft.Network/privateEndpoints@2024-05-01'
135135
}
136136
}
137137

138+
// Prevent Accidental Changes
139+
140+
resource azureAiSearchServiceLocks 'Microsoft.Authorization/locks@2020-05-01' = {
141+
scope: azureAiSearchService
142+
name: '${azureAiSearchService.name}-lock'
143+
properties: {
144+
level: 'CanNotDelete'
145+
notes: 'Prevent deleting; recovery not practical. Hard dependency for your AI Foundry Agent Service.'
146+
owners: []
147+
}
148+
}
149+
138150
// ---- Outputs ----
139151

140152
output aiSearchName string = azureAiSearchService.name

infra-as-code/bicep/cosmos-db.bicep

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,18 @@ resource assignDebugUserToCosmosAccountReader 'Microsoft.Authorization/roleAssig
200200
}
201201
}
202202

203+
// Prevent Accidental Changes
204+
205+
resource cosmosDbAccountLocks 'Microsoft.Authorization/locks@2020-05-01' = {
206+
scope: cosmosDbAccount
207+
name: '${cosmosDbAccount.name}-lock'
208+
properties: {
209+
level: 'CanNotDelete'
210+
notes: 'Prevent deleting; recovery not practical. Hard dependency for your AI Foundry Agent Service.'
211+
owners: []
212+
}
213+
}
214+
203215
// ---- Outputs ----
204216

205217
output cosmosDbAccountName string = cosmosDbAccount.name

0 commit comments

Comments
 (0)