Secure network agent via terraform to support isolated GA agents. #39
Replies: 4 comments
-
Very cool - thanks for sharing |
Beta Was this translation helpful? Give feedback.
-
Thanks for sharing @trentderby 🎉 - this is a great show and tell to support people taking Azure AI Foundry Agents from POC to production - especially as the service went GA at Microsoft Build on 19th May @guygregory will likely find this interesting for partners and customers |
Beta Was this translation helpful? Give feedback.
-
Thanks so much for sharing -- this will be super useful for any AI Foundry / Terraform user. |
Beta Was this translation helpful? Give feedback.
-
This is now in the main MS repo now - so I would recommend using that: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Introduction
Adding this so it will hopefully help some people who are more terraform-oriented to create secure network agents using AI foundry.
Basically, the terraform equivalent of this:
https://learn.microsoft.com/en-us/azure/ai-services/agents/how-to/virtual-networks
Some caveats -
This is a translation of the MS provided bicep over to terraform - a lot of the AzureRM providers do not yet exist - and the naming of some of them might confuse things a little - for this - the AI foundry project is the project I will be working off - so no AI hub involved - the existing supported terraform AzureRM provider for AI Foundry project creates a HUB based project, and network isolated agents are not yet supported for this - and are still not in GA at time of writing.
For the most part, AzAPI has been used to plug gaps, but it's functional and will work while we await the azurerm equivalents to come live in a few weeks.
Features and Screenshots
Creates a secure AI foundry + project with all necessary resources isolated and connected.
Technical Details
Terraform - using AzureRM and Azapi resources - plus PowerShell for cosmos DB permissions.
A lot of improvements can be made - this has been deployed a few times in our environment - would like to get the cosmos permissions also via TF, but palming that off to a PowerShell for now.
IAM permissions - by and large, you will be required to give the MIDs of each resource permission to other resources - please message if stuck on any of this.
PRIVATE ENDPOINTS:
Assumptions - awareness of how to create a private endpoint to secure resources - sample here given for cosmos DB, other subresources required are - account, Sql, vault, blob, file (not yet supported) and searchservice.
zone names required: privatelink.services.ai.azure.com, privatelink.cognitiveservices.azure.com, privatelink.vaultcore.azure.net, privatelink.file.core.windows.net, privatelink.blob.core.windows.net, privatelink.search.windows.net, privatelink.openai.azure.com
NETWORKING:
Outside of all resources being behind PEs (as above) - the network itself will need to have a specific addressing - B or C type network - the agent will not work unless configured this way - here is a sample of vnet and subnet config - VNET - then 2 subnets, one for private endpoints and resources, the other dedicated to agents:
Variables for network address space (smaller than ms reccomendation for our environment, has to be a class B or C network):
AI FOUNDRY RESOURCES/CONNECTIONS:
The main "secret sauce" of the BICEP - is the capability host - that is the key to having all of this work correctly - please ensure all resources are in the same region - please note you will also have to run a az cli to give cosmos DB permissions over - ill be working on getting this into TF.
COSMOS DB Script
IAM Permissions
I made a table out of the IAM we have set up for this - here is a snippet of one role:
IAM would be too large to post in here, but I have got an output in a table format:
IAM Permissions Overview Table
Search Service Permissions
AI Foundry Permissions
Cross-Service AI Permissions
Storage Account Permissions
Private Endpoint Permissions
Application Insights Permissions
Cosmos DB Permissions
Challenges and Solutions
Usual challenges with the DNS endpoints and pointing to a 172.x.x.x network. have your networking team on standby to ensure all resources can resolve to each other.
A lot of IAM permissions required for inter resource. MIDs are used for everything in this project and work.
This is by no means fully complete and a lot of improvements to come - but I'm hoping this can get some of you started using secure AI foundry via terraform.
Beta Was this translation helpful? Give feedback.
All reactions