Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions quickstart/101-azure-ai-foundry-account/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Azure AI Foundry Account

This deployment configuration specifies an [Azure AI Foundry Account](https://learn.microsoft.com/en-us/azure/ai-foundry/what-is-azure-ai-foundry) and a deployment of the OpenAI 4.1 model.

This configuration describes the minimal set of resources you require to get started with Azure AI Foundry Accounts.
100 changes: 100 additions & 0 deletions quickstart/101-azure-ai-foundry-account/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
########## Create infrastructure resources
##########

## Get subscription data
##

data "azurerm_client_config" "current" {}

## Create a random string
##
resource "random_string" "unique" {
length = 4
min_numeric = 4
numeric = true
special = false
lower = true
upper = false
}

## Create a resource group for the resources to be stored in
##
resource "azurerm_resource_group" "rg" {
name = "${var.resource_group_name_prefix}-aifoundry${random_string.unique.result}"
location = var.region
}

########## Create AI Foundry resource
##########

## Create the AI Foundry resource
##
resource "azapi_resource" "ai_foundry" {
depends_on = [
azapi_resource_action.purge_ai_foundry
]

type = "Microsoft.CognitiveServices/accounts@2025-06-01"
name = "aifoundry${random_string.unique.result}"
parent_id = azurerm_resource_group.rg.id
location = var.region
schema_validation_enabled = false

body = {
kind = "AIServices",
sku = {
name = "S0"
}
identity = {
type = "SystemAssigned"
}

properties = {
# Support both Entra ID and API Key authentication for underlining Cognitive Services account
disableLocalAuth = false

# Specifies that this is an AI Foundry resource
allowProjectManagement = true

# Set custom subdomain name for DNS names created for this Foundry resource
customSubDomainName = "aifoundry${random_string.unique.result}"

# Network-related controls
# Disable public access but allow Trusted Azure Services exception
publicNetworkAccess = "Enabled"
networkAcls = {
defaultAction = "Allow"
}
}
}
}

## Create a deployment for OpenAI's GPT-4.1 in the AI Foundry resource
##
resource "azurerm_cognitive_deployment" "aifoundry_deployment_gpt_41" {
depends_on = [
azapi_resource.ai_foundry
]

name = "gpt-4.1"
cognitive_account_id = azapi_resource.ai_foundry.id

sku {
name = "GlobalStandard"
capacity = 1
}

model {
format = "OpenAI"
name = "gpt-4.1"
version = "2025-04-14"
}
}

## Added AI Foundry account purger to purge AI Foundry Account after deletion
resource "azapi_resource_action" "purge_ai_foundry" {
method = "DELETE"
resource_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}/providers/Microsoft.CognitiveServices/locations/${azurerm_resource_group.rg.location}/resourceGroups/${azurerm_resource_group.rg.name}/deletedAccounts/aifoundry${random_string.unique.result}"
type = "Microsoft.Resources/resourceGroups/deletedAccounts@2021-04-30"
when = "destroy"
}
7 changes: 7 additions & 0 deletions quickstart/101-azure-ai-foundry-account/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}

output "ai_foundry_name" {
value = azapi_resource.ai_foundry.name
}
34 changes: 34 additions & 0 deletions quickstart/101-azure-ai-foundry-account/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
terraform {
required_version = ">= 1.10.0, < 2.0.0"
required_providers {
azapi = {
source = "azure/azapi"
version = "~> 2.5"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.37"
}
random = {
source = "hashicorp/random"
version = "~> 3.7"
}
time = {
source = "hashicorp/time"
version = "~> 0.13"
}
}
}

# Setup providers
provider "azapi" {
}

provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
storage_use_azuread = true
}
10 changes: 10 additions & 0 deletions quickstart/101-azure-ai-foundry-account/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "region" {
description = "The Azure region to deploy the resources to"
type = string
}

variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
}
5 changes: 5 additions & 0 deletions quickstart/201-azure-ai-foundry-basic-agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Azure AI Foundry Account with Basic Agent

This deployment configuration specifies an [Azure AI Foundry Account](https://learn.microsoft.com/en-us/azure/ai-foundry/what-is-azure-ai-foundry) and a deployment of the OpenAI 4.1 model. An AI Foundry Project is deployed within the AI Foundry Account to be used to [build basic agents](https://learn.microsoft.com/en-us/azure/ai-foundry/agents/overview) with the Agent Service.

This configuration describes the minimal set of resources you require to get started with AI Foundry Accounts, Projects, and the Agent Service.
127 changes: 127 additions & 0 deletions quickstart/201-azure-ai-foundry-basic-agent/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
########## Create infrastructure resources
##########

## Get subscription data
##

data "azurerm_client_config" "current" {}

## Create a random string
##
resource "random_string" "unique" {
length = 4
min_numeric = 4
numeric = true
special = false
lower = true
upper = false
}

## Create a resource group for the resources to be stored in
##
resource "azurerm_resource_group" "rg" {
name = "${var.resource_group_name_prefix}-aifoundry${random_string.unique.result}"
location = var.region
}

########## Create AI Foundry resource
##########

## Create the AI Foundry resource
##
resource "azapi_resource" "ai_foundry" {
depends_on = [
azapi_resource_action.purge_ai_foundry
]

type = "Microsoft.CognitiveServices/accounts@2025-06-01"
name = "aifoundry${random_string.unique.result}"
parent_id = azurerm_resource_group.rg.id
location = var.region
schema_validation_enabled = false

body = {
kind = "AIServices",
sku = {
name = "S0"
}
identity = {
type = "SystemAssigned"
}

properties = {
# Support both Entra ID and API Key authentication for underlining Cognitive Services account
disableLocalAuth = false

# Specifies that this is an AI Foundry resource
allowProjectManagement = true

# Set custom subdomain name for DNS names created for this Foundry resource
customSubDomainName = "aifoundry${random_string.unique.result}"

# Network-related controls
# Disable public access but allow Trusted Azure Services exception
publicNetworkAccess = "Enabled"
networkAcls = {
defaultAction = "Allow"
}
}
}
}

## Create a deployment for OpenAI's GPT-4.1 in the AI Foundry resource
##
resource "azurerm_cognitive_deployment" "aifoundry_deployment_gpt_41" {
depends_on = [
azapi_resource.ai_foundry
]

name = "gpt-4.1"
cognitive_account_id = azapi_resource.ai_foundry.id

sku {
name = "GlobalStandard"
capacity = 1
}

model {
format = "OpenAI"
name = "gpt-4.1"
version = "2025-04-14"
}
}

resource "azapi_resource" "ai_foundry_project" {
depends_on = [
azapi_resource.ai_foundry,
azurerm_cognitive_deployment.aifoundry_deployment_gpt_41
]

type = "Microsoft.CognitiveServices/accounts/projects@2025-06-01"
name = "project${random_string.unique.result}"
parent_id = azapi_resource.ai_foundry.id
location = var.region
schema_validation_enabled = false

body = {
sku = {
name = "S0"
}
identity = {
type = "SystemAssigned"
}

properties = {
displayName = "project"
description = "A project for the AI Foundry account with network secured deployed Agent"
}
}
}

## Added AI Foundry account purger to purge the AI Foundry Account after deletion
resource "azapi_resource_action" "purge_ai_foundry" {
method = "DELETE"
resource_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}/providers/Microsoft.CognitiveServices/locations/${azurerm_resource_group.rg.location}/resourceGroups/${azurerm_resource_group.rg.name}/deletedAccounts/aifoundry${random_string.unique.result}"
type = "Microsoft.Resources/resourceGroups/deletedAccounts@2021-04-30"
when = "destroy"
}
11 changes: 11 additions & 0 deletions quickstart/201-azure-ai-foundry-basic-agent/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
output "resource_group_name" {
value = azurerm_resource_group.rg.name
}

output "ai_foundry_account_name" {
value = azapi_resource.ai_foundry.name
}

output "ai_foundry_project_name" {
value = azapi_resource.ai_foundry_project.name
}
35 changes: 35 additions & 0 deletions quickstart/201-azure-ai-foundry-basic-agent/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
terraform {
required_version = ">= 1.10.0, < 2.0.0"
required_providers {
azapi = {
source = "azure/azapi"
version = "~> 2.5"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.37"
}
random = {
source = "hashicorp/random"
version = "~> 3.7"
}
time = {
source = "hashicorp/time"
version = "~> 0.13"
}
}

}

# Setup providers
provider "azapi" {
}

provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
storage_use_azuread = true
}
10 changes: 10 additions & 0 deletions quickstart/201-azure-ai-foundry-basic-agent/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variable "region" {
description = "The Azure region to deploy the resources to"
type = string
}

variable "resource_group_name_prefix" {
type = string
default = "rg"
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Azure AI Foundry Account with Standard Agent

This deployment configuration specifies an [Azure AI Foundry Account](https://learn.microsoft.com/en-us/azure/ai-foundry/what-is-azure-ai-foundry) and a deployment of the OpenAI 4.1 model. An AI Foundry Project is deployed within the AI Foundry Account. The AI Foundry Account and Project are configured to support the Agent Service with a [standard agent](https://learn.microsoft.com/en-us/azure/ai-foundry/agents/concepts/standard-agent-setup).

This configuration describes the minimal set of resources you require to get started with Azure AI Foundry Accounts, Projects, and Agent Service configured in a Standard Agent configuration.
Loading
Loading