-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathazuredeploy.json
More file actions
161 lines (161 loc) · 8.53 KB
/
Copy pathazuredeploy.json
File metadata and controls
161 lines (161 loc) · 8.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "azure-context-cache-quickstart",
"version": "2.0.0"
},
"description": "One-click end-to-end setup: creates an Azure OpenAI (Cognitive Services) account, an Azure Context Cache account + container, and an AOAI deployment that is linked to the cache container via properties.contextCacheContainerId. All defaults preconfigured for Central US."
},
"parameters": {
"namePrefix": {
"type": "string",
"defaultValue": "",
"maxLength": 12,
"metadata": {
"description": "Short prefix used to name the cache resources. 3-12 lowercase letters/digits, or leave empty to auto-generate."
}
},
"existingAoaiAccountName": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "OPTIONAL. Name of an existing Azure OpenAI (Cognitive Services) account in this resource group to attach the cache-linked deployment to. Leave empty to create a new AOAI account (requires S0 account quota)."
}
},
"principalId": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "OPTIONAL. AAD object ID to grant 'Cognitive Services OpenAI User' role on the AOAI account (so the demo can run keyless via DefaultAzureCredential). Leave empty to auto-detect the deploying user."
}
},
"principalType": {
"type": "string",
"defaultValue": "User",
"allowedValues": [ "User", "ServicePrincipal", "Group" ],
"metadata": {
"description": "Type of the principal receiving the role assignment. Use 'ServicePrincipal' for a managed identity or service principal."
}
}
},
"variables": {
"effectiveNamePrefix": "[if(empty(parameters('namePrefix')), concat('cc', substring(uniqueString(resourceGroup().id), 0, 10)), parameters('namePrefix'))]",
"createAoai": "[empty(parameters('existingAoaiAccountName'))]",
"newAoaiAccountName": "[concat(variables('effectiveNamePrefix'), '-aoai')]",
"aoaiAccountName": "[if(variables('createAoai'), variables('newAoaiAccountName'), parameters('existingAoaiAccountName'))]",
"cacheAccountName": "[concat(variables('effectiveNamePrefix'), '-cache')]",
"cacheContainerName": "default-container",
"aoaiDeploymentName": "context-cache-deployment",
"modelName": "gpt-5.4",
"modelVersion": "2026-03-05-contextcache",
"modelFormat": "OpenAI",
"skuName": "Standard",
"skuCapacity": 100,
"timeToLiveDays": 7,
"containerResourceId": "[resourceId('Microsoft.AzureContextCache/accounts/containers', variables('cacheAccountName'), variables('cacheContainerName'))]",
"effectivePrincipalId": "[if(empty(parameters('principalId')), deployer().objectId, parameters('principalId'))]",
"assignRole": "[and(variables('createAoai'), not(empty(variables('effectivePrincipalId'))))]",
"openAiUserRoleId": "5e0bd9bd-7b93-4f28-af87-19fc36ad61bd",
"roleAssignmentName": "[guid(resourceId('Microsoft.CognitiveServices/accounts', variables('aoaiAccountName')), variables('effectivePrincipalId'), variables('openAiUserRoleId'))]",
"tags": {
"sample": "azure-context-cache-quickstart",
"environment": "demo"
}
},
"resources": [
{
"comments": "1. Azure OpenAI (Cognitive Services) account. Skipped when existingAoaiAccountName is provided.",
"condition": "[variables('createAoai')]",
"type": "Microsoft.CognitiveServices/accounts",
"apiVersion": "2024-10-01",
"name": "[variables('aoaiAccountName')]",
"location": "[resourceGroup().location]",
"tags": "[variables('tags')]",
"kind": "OpenAI",
"sku": {
"name": "S0"
},
"properties": {
"customSubDomainName": "[variables('aoaiAccountName')]",
"publicNetworkAccess": "Enabled"
}
},
{
"comments": "2. Context Cache account.",
"type": "Microsoft.AzureContextCache/accounts",
"apiVersion": "2026-01-01-preview",
"name": "[variables('cacheAccountName')]",
"location": "[resourceGroup().location]",
"tags": "[variables('tags')]",
"properties": {
"accountKind": "Regional",
"description": "Context Cache account (azure-context-cache-quickstart)"
}
},
{
"comments": "3. Context Cache container bound to the chosen model.",
"type": "Microsoft.AzureContextCache/accounts/containers",
"apiVersion": "2026-01-01-preview",
"name": "[concat(variables('cacheAccountName'), '/', variables('cacheContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.AzureContextCache/accounts', variables('cacheAccountName'))]"
],
"properties": {
"description": "[concat('Prompt cache container for ', variables('modelName'))]",
"modelName": "[variables('modelName')]",
"provider": "OpenAI",
"timeToLive": "[variables('timeToLiveDays')]"
}
},
{
"comments": "4. AOAI deployment linked to the cache container via contextCacheContainerId.",
"type": "Microsoft.CognitiveServices/accounts/deployments",
"apiVersion": "2026-03-15-preview",
"name": "[concat(variables('aoaiAccountName'), '/', variables('aoaiDeploymentName'))]",
"dependsOn": [
"[resourceId('Microsoft.CognitiveServices/accounts', variables('aoaiAccountName'))]",
"[resourceId('Microsoft.AzureContextCache/accounts/containers', variables('cacheAccountName'), variables('cacheContainerName'))]"
],
"sku": {
"name": "[variables('skuName')]",
"capacity": "[variables('skuCapacity')]"
},
"properties": {
"model": {
"format": "[variables('modelFormat')]",
"name": "[variables('modelName')]",
"version": "[variables('modelVersion')]"
},
"contextCacheContainerId": "[variables('containerResourceId')]"
}
},
{
"comments": "5. Grant the deploying user (or a passed-in principal) 'Cognitive Services OpenAI User' on the AOAI account so the included demo can run keyless via DefaultAzureCredential.",
"condition": "[variables('assignRole')]",
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2022-04-01",
"name": "[variables('roleAssignmentName')]",
"scope": "[concat('Microsoft.CognitiveServices/accounts/', variables('aoaiAccountName'))]",
"dependsOn": [
"[resourceId('Microsoft.CognitiveServices/accounts', variables('aoaiAccountName'))]"
],
"properties": {
"roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', variables('openAiUserRoleId'))]",
"principalId": "[variables('effectivePrincipalId')]",
"principalType": "[parameters('principalType')]"
}
}
],
"outputs": {
"azureOpenAIAccountName": { "type": "string", "value": "[variables('aoaiAccountName')]" },
"azureOpenAIEndpoint": { "type": "string", "value": "[reference(resourceId('Microsoft.CognitiveServices/accounts', variables('aoaiAccountName')), '2024-10-01').endpoint]" },
"aoaiDeploymentName": { "type": "string", "value": "[variables('aoaiDeploymentName')]" },
"contextCacheAccountName":{ "type": "string", "value": "[variables('cacheAccountName')]" },
"contextCacheContainerId":{ "type": "string", "value": "[variables('containerResourceId')]" },
"modelName": { "type": "string", "value": "[variables('modelName')]" },
"modelVersion": { "type": "string", "value": "[variables('modelVersion')]" },
"openAIUserPrincipalId": { "type": "string", "value": "[if(variables('assignRole'), variables('effectivePrincipalId'), '')]" }
}
}