Skip to content

Commit 2c144ba

Browse files
authored
Merge pull request #49 from MicrosoftCloudEssentials-LearningHub/foundry
Foundry
2 parents a325f26 + 35fc90b commit 2c144ba

File tree

27 files changed

+908
-7
lines changed

27 files changed

+908
-7
lines changed

5_analytics-bigdata/event-hub/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2026-02-16
8+
Last updated: 2026-02-17
99

1010
------------------------------------------
1111

@@ -78,3 +78,10 @@ Last updated: 2026-02-16
7878
```sh
7979
terraform apply -auto-approve
8080
```
81+
82+
<!-- START BADGE -->
83+
<div align="center">
84+
<img src="https://img.shields.io/badge/Total%20views-1930-limegreen" alt="Total views">
85+
<p>Refresh Date: 2026-02-17</p>
86+
</div>
87+
<!-- END BADGE -->

5_analytics-bigdata/fabric/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2026-02-16
8+
Last updated: 2026-02-17
99

1010
------------------------------------------
1111

@@ -83,3 +83,10 @@ Last updated: 2026-02-16
8383
```sh
8484
terraform apply -auto-approve
8585
```
86+
87+
<!-- START BADGE -->
88+
<div align="center">
89+
<img src="https://img.shields.io/badge/Total%20views-1930-limegreen" alt="Total views">
90+
<p>Refresh Date: 2026-02-17</p>
91+
</div>
92+
<!-- END BADGE -->

6_monitoring-management/advisor/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2026-02-16
8+
Last updated: 2026-02-17
99

1010
------------------------------------------
1111

@@ -25,3 +25,10 @@ terraform validate
2525
terraform plan
2626
terraform apply -auto-approve
2727
```
28+
29+
<!-- START BADGE -->
30+
<div align="center">
31+
<img src="https://img.shields.io/badge/Total%20views-1930-limegreen" alt="Total views">
32+
<p>Refresh Date: 2026-02-17</p>
33+
</div>
34+
<!-- END BADGE -->

6_monitoring-management/automation/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2026-02-16
8+
Last updated: 2026-02-17
99

1010
------------------------------------------
1111

@@ -32,3 +32,10 @@ terraform validate
3232
terraform plan
3333
terraform apply -auto-approve
3434
```
35+
36+
<!-- START BADGE -->
37+
<div align="center">
38+
<img src="https://img.shields.io/badge/Total%20views-1930-limegreen" alt="Total views">
39+
<p>Refresh Date: 2026-02-17</p>
40+
</div>
41+
<!-- END BADGE -->

6_monitoring-management/log-analytics/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2026-02-16
8+
Last updated: 2026-02-17
99

1010
------------------------------------------
1111

@@ -49,3 +49,10 @@ terraform validate
4949
terraform plan
5050
terraform apply -auto-approve
5151
```
52+
53+
<!-- START BADGE -->
54+
<div align="center">
55+
<img src="https://img.shields.io/badge/Total%20views-1930-limegreen" alt="Total views">
56+
<p>Refresh Date: 2026-02-17</p>
57+
</div>
58+
<!-- END BADGE -->

6_monitoring-management/monitor/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2026-02-16
8+
Last updated: 2026-02-17
99

1010
------------------------------------------
1111

@@ -22,3 +22,10 @@ terraform validate
2222
terraform plan
2323
terraform apply -auto-approve
2424
```
25+
26+
<!-- START BADGE -->
27+
<div align="center">
28+
<img src="https://img.shields.io/badge/Total%20views-1930-limegreen" alt="Total views">
29+
<p>Refresh Date: 2026-02-17</p>
30+
</div>
31+
<!-- END BADGE -->

8_ai-ml/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2026-02-09
8+
Last updated: 2026-02-16
99

1010
------------------------------------------
1111

1212
> [!IMPORTANT]
1313
> This folder contains sample Terraform templates for Azure AI and machine learning services. These templates are starting points and should be customized based on your application needs.
1414
15+
## Templates available
16+
17+
- [Azure Machine Learning (Workspace)](./machine-learning)
18+
- [Azure AI Search (Search Service)](./ai-search)
19+
- [Azure AI Services (Cognitive Services Account)](./ai-services)
20+
- [Microsoft Foundry (Azure AI Foundry Account + Project)](./ai-foundry)
21+
1522
<!-- START BADGE -->
1623
<div align="center">
1724
<img src="https://img.shields.io/badge/Total%20views-1930-limegreen" alt="Total views">

8_ai-ml/ai-foundry/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Terraform Template - Microsoft Foundry (Azure AI Foundry)
2+
3+
Costa Rica
4+
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6+
[brown9804](https://github.com/brown9804)
7+
8+
Last updated: 2026-02-17
9+
10+
------------------------------------------
11+
12+
> This template creates a Microsoft Foundry account (Cognitive Services account kind `AIServices`) and an optional Foundry project.
13+
14+
<img width="650" alt="image" src="https://github.com/user-attachments/assets/2a2533c3-3052-43ea-be41-02eea066bdd1" />
15+
16+
<img width="650" alt="image" src="https://github.com/user-attachments/assets/303fb22c-3bdb-4ed3-9691-87ea72a0ecc3" />
17+
18+
<img width="650" alt="image" src="https://github.com/user-attachments/assets/4319f24c-e3df-483f-9a8f-73095ca4b10e" />
19+
20+
## Usage
21+
22+
```sh
23+
az login
24+
terraform init -upgrade
25+
terraform validate
26+
terraform plan
27+
terraform apply -auto-approve
28+
```
29+
30+
<!-- START BADGE -->
31+
<div align="center">
32+
<img src="https://img.shields.io/badge/Total%20views-1930-limegreen" alt="Total views">
33+
<p>Refresh Date: 2026-02-17</p>
34+
</div>
35+
<!-- END BADGE -->

8_ai-ml/ai-foundry/main.tf

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
data "azurerm_client_config" "current" {}
2+
3+
resource "azapi_resource" "resource_group" {
4+
type = "Microsoft.Resources/resourceGroups@2022-09-01"
5+
name = var.resource_group_name
6+
location = var.location
7+
parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}"
8+
9+
body = jsonencode({
10+
tags = var.tags
11+
})
12+
13+
response_export_values = [
14+
"id",
15+
"name"
16+
]
17+
}
18+
19+
resource "random_string" "suffix" {
20+
length = var.random_suffix_length
21+
upper = false
22+
special = false
23+
numeric = true
24+
25+
keepers = {
26+
resource_group_name = var.resource_group_name
27+
location = var.location
28+
base_name = var.foundry_account_name
29+
sku = var.sku_name
30+
allow_project_management = tostring(var.allow_project_management)
31+
public_network_access = tostring(var.public_network_access_enabled)
32+
}
33+
}
34+
35+
locals {
36+
suffix = var.append_random_suffix ? random_string.suffix.result : ""
37+
name_raw = var.append_random_suffix ? "${var.foundry_account_name}-${local.suffix}" : var.foundry_account_name
38+
39+
custom_subdomain_name_effective = (
40+
(var.custom_subdomain_name != null ? trimspace(var.custom_subdomain_name) : "") != ""
41+
? trimspace(var.custom_subdomain_name)
42+
: "cog-${replace(lower(local.name_raw), "_", "-")}" # best-effort derivation
43+
)
44+
45+
project_name_effective = (
46+
(var.project_name != null ? trimspace(var.project_name) : "") != ""
47+
? trimspace(var.project_name)
48+
: substr(replace(local.name_raw, "-", ""), 0, 64)
49+
)
50+
51+
project_display_name_effective = (
52+
(var.project_display_name != null ? trimspace(var.project_display_name) : "") != ""
53+
? trimspace(var.project_display_name)
54+
: "project-${local.name_raw}"
55+
)
56+
57+
public_network_access = var.public_network_access_enabled ? "Enabled" : "Disabled"
58+
}
59+
60+
resource "azapi_resource" "foundry_account" {
61+
# Use the newer api-version so Foundry-specific properties (like allowProjectManagement)
62+
# are recognized by the resource provider. Schema validation is disabled to avoid
63+
# AzAPI embedded schema lagging the service.
64+
type = "Microsoft.CognitiveServices/accounts@2025-06-01"
65+
schema_validation_enabled = false
66+
name = local.name_raw
67+
location = var.location
68+
parent_id = azapi_resource.resource_group.id
69+
70+
identity {
71+
type = var.enable_system_assigned_identity ? "SystemAssigned" : "None"
72+
}
73+
74+
body = jsonencode({
75+
kind = "AIServices"
76+
properties = {
77+
allowProjectManagement = var.allow_project_management
78+
customSubDomainName = local.custom_subdomain_name_effective
79+
publicNetworkAccess = local.public_network_access
80+
disableLocalAuth = false
81+
dynamicThrottlingEnabled = false
82+
restrictOutboundNetworkAccess = false
83+
}
84+
sku = {
85+
name = var.sku_name
86+
}
87+
tags = var.tags
88+
})
89+
90+
response_export_values = ["*"]
91+
92+
depends_on = [
93+
azapi_resource.resource_group
94+
]
95+
}
96+
97+
resource "azapi_resource" "foundry_project" {
98+
count = var.create_project ? 1 : 0
99+
100+
# The projects subresource may not have schema coverage in AzAPI; disable schema validation.
101+
type = "Microsoft.CognitiveServices/accounts/projects@2025-06-01"
102+
schema_validation_enabled = false
103+
name = local.project_name_effective
104+
location = var.location
105+
parent_id = azapi_resource.foundry_account.id
106+
107+
identity {
108+
type = "SystemAssigned"
109+
}
110+
111+
body = jsonencode({
112+
properties = {
113+
displayName = local.project_display_name_effective
114+
description = var.project_description
115+
}
116+
tags = var.tags
117+
})
118+
119+
response_export_values = ["*"]
120+
121+
depends_on = [
122+
azapi_resource.foundry_account
123+
]
124+
}

8_ai-ml/ai-foundry/outputs.tf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
output "resource_group_id" {
2+
description = "The resource ID of the Resource Group."
3+
value = azapi_resource.resource_group.id
4+
}
5+
6+
output "foundry_account_id" {
7+
description = "The resource ID of the Foundry account (Cognitive Services account kind AIServices)."
8+
value = azapi_resource.foundry_account.id
9+
}
10+
11+
output "foundry_account_name" {
12+
description = "The name of the Foundry account."
13+
value = azapi_resource.foundry_account.name
14+
}
15+
16+
output "foundry_account_endpoint" {
17+
description = "The endpoint of the Foundry account (when available in the resource properties)."
18+
value = try(jsondecode(azapi_resource.foundry_account.output).properties.endpoint, null)
19+
}
20+
21+
output "foundry_project_id" {
22+
description = "The resource ID of the Foundry project (if created)."
23+
value = try(azapi_resource.foundry_project[0].id, null)
24+
}
25+
26+
output "foundry_project_name" {
27+
description = "The name of the Foundry project (if created)."
28+
value = try(azapi_resource.foundry_project[0].name, null)
29+
}

0 commit comments

Comments
 (0)