Skip to content

Commit e4c2b47

Browse files
authored
Add policy sample to restrict to aiservices kind (#350)
* deny connection variants * include custom policy samples * add sample * fix sample * fix missing var
1 parent f8d7ccc commit e4c2b47

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

samples/microsoft/infrastructure-setup-terraform/00-basic-azurerm/code/providers.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
provider "azurerm" {
33
features {}
44
storage_use_azuread = true
5+
subscription_id = var.subscription_id
56
}

samples/microsoft/infrastructure-setup-terraform/00-basic-azurerm/code/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ variable "location" {
22
description = "The name of the location to provision the resources to"
33
type = string
44
}
5+
6+
variable "subscription_id" {
7+
type = string
8+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Setup providers
22
provider "azapi" {
3+
subscription_id = var.subscription_id
34
}

samples/microsoft/infrastructure-setup-terraform/00-basic/code/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ variable "location" {
22
description = "The name of the location to provision the resources to"
33
type = string
44
}
5+
6+
variable "subscription_id" {
7+
type = string
8+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"properties": {
3+
"displayName": "Deny account kinds that do not support the full AI Foundry capabilities.",
4+
"policyType": "Custom",
5+
"mode": "All",
6+
"description": "This policy denies the creation of account kinds that do not support the full AI Foundry capabilities.",
7+
"version": "1.0.0",
8+
"parameters": {},
9+
"policyRule": {
10+
"if": {
11+
"allOf": [
12+
{
13+
"field": "type",
14+
"equals": "Microsoft.CognitiveServices/accounts"
15+
},
16+
{
17+
"field": "kind",
18+
"notEquals": "AIServices"
19+
}
20+
]
21+
},
22+
"then": {
23+
"effect": "deny"
24+
}
25+
},
26+
"versions": [
27+
"1.0.0"
28+
]
29+
}
30+
}

0 commit comments

Comments
 (0)