Skip to content

Commit 4cd996e

Browse files
Merge pull request #477 from microsoft/dev
fix: AVM guidelines & version issue fix
2 parents b6ab953 + 234b18b commit 4cd996e

File tree

8 files changed

+313
-11
lines changed

8 files changed

+313
-11
lines changed

Deployment/resourcedeployment.ps1

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
# Copyright (c) Microsoft Corporation.
1+
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT license.
33

44
#https://patorjk.com/software/taag
5+
6+
7+
param (
8+
[Parameter(Mandatory=$false)]
9+
[string]$ResourceGroupName
10+
)
11+
512
function startBanner() {
613
Write-Host " _____ _ "
714
Write-Host " | __ \ | | "
@@ -195,7 +202,10 @@ function Show-Banner {
195202
}
196203

197204
# Get all environment values
198-
$envValues = azd env get-values --output json | ConvertFrom-Json
205+
if (!$ResourceGroupName) {
206+
$envValues = azd env get-values --output json | ConvertFrom-Json
207+
}
208+
199209
function Get-AzdEnvValueOrDefault {
200210
param (
201211
[Parameter(Mandatory = $true)]
@@ -290,7 +300,7 @@ class DeploymentResult {
290300

291301
}
292302

293-
[void]MapResult() {
303+
[void]MapResultAzd() {
294304

295305
# Replace direct $envValues lookups with function calls
296306
$this.TenantId = Get-AzdEnvValueOrDefault -KeyName "AZURE_TENANT_ID" -Required $true
@@ -335,6 +345,68 @@ class DeploymentResult {
335345
$this.AzAppConfigEndpoint = Get-AzdEnvValueOrDefault -KeyName "AZURE_APP_CONFIG_ENDPOINT"
336346
$this.AzAppConfigName = Get-AzdEnvValueOrDefault -KeyName "AZURE_APP_CONFIG_NAME"
337347
}
348+
349+
[void]MapResultAz([string]$resourceGroupName) {
350+
# Get deployment outputs
351+
$deploymentName=$(az group show --name "$resourceGroupName" --query "tags.DeploymentName" -o tsv)
352+
if (!$deploymentName) {
353+
Write-Error "Deployment name not found in the resource group tags."
354+
exit 1
355+
}
356+
357+
$deploymentOutputs=$(az deployment group show --resource-group "$resourceGroupName" --name "$deploymentName" --query "properties.outputs" -o json | ConvertFrom-Json)
358+
359+
$this.TenantId = $deploymentOutputs.azurE_TENANT_ID.value
360+
if (!$this.TenantId) {
361+
$this.TenantId = $(az account show --query tenantId -o tsv)
362+
}
363+
364+
$this.SubscriptionId = $(az account show --query id -o tsv)
365+
366+
# Resource Group
367+
$this.ResourceGroupName = $resourceGroupName
368+
$this.ResourceGroupId = $deploymentOutputs.azurE_RESOURCE_GROUP_ID.value
369+
if (!$this.ResourceGroupId) {
370+
Write-Error "Required value 'AZURE_RESOURCE_GROUP_ID' not found in the deployment outputs."
371+
exit 1
372+
}
373+
374+
# Storage Account
375+
$this.StorageAccountName = $deploymentOutputs.storagE_ACCOUNT_NAME.value
376+
377+
# Search Service
378+
$this.AzSearchServiceName = $deploymentOutputs.azurE_SEARCH_SERVICE_NAME.value
379+
$this.AzSearchServicEndpoint = "https://$($this.AzSearchServiceName).search.windows.net"
380+
381+
# AKS
382+
$this.AksName = $deploymentOutputs.azurE_AKS_NAME.value
383+
$this.AksMid = $deploymentOutputs.azurE_AKS_MI_ID.value
384+
385+
# Container Registry
386+
$this.AzContainerRegistryName = $deploymentOutputs.azurE_CONTAINER_REGISTRY_NAME.value
387+
388+
# Cognitive Service - Azure AI Document Intelligence Service
389+
$this.AzCognitiveServiceName = $deploymentOutputs.azurE_COGNITIVE_SERVICE_NAME.value
390+
$this.AzCognitiveServiceEndpoint = $deploymentOutputs.azurE_COGNITIVE_SERVICE_ENDPOINT.value
391+
392+
# Open AI Service
393+
$this.AzOpenAiServiceName = $deploymentOutputs.azurE_OPENAI_SERVICE_NAME.value
394+
$this.AzOpenAiServiceEndpoint = $deploymentOutputs.azurE_OPENAI_SERVICE_ENDPOINT.value
395+
396+
# Cosmos DB
397+
$this.AzCosmosDBName = $deploymentOutputs.azurE_COSMOSDB_NAME.value
398+
399+
# Open AI Service Models
400+
$this.AzGPT4oModelName = $deploymentOutputs.aZ_GPT4O_MODEL_NAME.value
401+
$this.AzGPT4oModelId = $deploymentOutputs.aZ_GPT4O_MODEL_ID.value
402+
$this.AzGPTEmbeddingModelName = $deploymentOutputs.aZ_GPT_EMBEDDING_MODEL_NAME.value
403+
$this.AzGPTEmbeddingModelId = $deploymentOutputs.aZ_GPT_EMBEDDING_MODEL_ID.value
404+
405+
# App Configuration
406+
$this.AzAppConfigEndpoint = $deploymentOutputs.azurE_APP_CONFIG_ENDPOINT.value
407+
$this.AzAppConfigName = $deploymentOutputs.azurE_APP_CONFIG_NAME.value
408+
409+
}
338410
}
339411

340412
function Check-Docker {
@@ -379,7 +451,12 @@ try {
379451
Write-Host "Retrieving the deployment details.....`r`n" -ForegroundColor Yellow
380452

381453
# Map the deployment result to DeploymentResult object from .env file
382-
$deploymentResult.MapResult()
454+
if ($ResourceGroupName) {
455+
$deploymentResult.MapResultAz($ResourceGroupName.Trim())
456+
}
457+
else {
458+
$deploymentResult.MapResultAzd()
459+
}
383460

384461
LoginAzure $deploymentResult.TenantId $deploymentResult.SubscriptionId
385462

docs/AVMPostDeploymentGuide.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# AVM Post Deployment Guide
2+
3+
> **📋 Note**: This guide is specifically for post-deployment steps after using the AVM template. For complete deployment from scratch, see the main [Deployment Guide](./DeploymentGuide.md).
4+
5+
---
6+
7+
This document provides guidance on post-deployment steps after deploying the Document Knowledge Mining Solution Accelerator from the [AVM (Azure Verified Modules) repository](https://github.com/Azure/bicep-registry-modules/tree/main/avm/ptn/sa/document-knowledge-mining).
8+
9+
## Overview
10+
11+
After deploying the infrastructure using AVM, you'll need to complete the application layer setup, which includes:
12+
- Configuring Kubernetes infrastructure
13+
- Building and deploying container images
14+
- Setting up certificates and ingress controllers
15+
- Configuring application settings
16+
17+
## Prerequisites
18+
19+
Before starting the post-deployment process, ensure you have the following:
20+
21+
### Required Software
22+
23+
1. **[PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.4)** <small>(v7.0+ recommended, v5.1+ minimum)</small> - Available for Windows, macOS, and Linux
24+
25+
2. **[Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)** <small>(v2.50+)</small> - Command-line tool for managing Azure resources
26+
27+
3. **kubectl** - Kubernetes command-line tool
28+
Install using Azure CLI:
29+
```powershell
30+
az aks install-cli
31+
```
32+
33+
4. **aks-preview extension** - Azure CLI extension for AKS preview features
34+
```powershell
35+
az extension add --name aks-preview
36+
```
37+
38+
5. **[Helm](https://helm.sh/docs/intro/install/)** <small>(v3.0+)</small> - Package manager for Kubernetes
39+
40+
6. **[Docker Desktop](https://docs.docker.com/get-docker/)** - Container platform for building and publishing images
41+
> ⚠️ **Important**: Ensure Docker Desktop is running before executing the deployment script
42+
43+
### Azure Requirements
44+
45+
7. **Azure Access** - One of the following roles on the subscription:
46+
- `Owner`
47+
- `User Access Administrator`
48+
49+
8. **Microsoft.Compute Registration** - Verify this resource provider is registered:
50+
1. Navigate to [Azure Portal](https://portal.azure.com)
51+
2. Go to your **Azure subscription**
52+
3. Select **Settings****Resource Providers**
53+
4. Search for **Microsoft.Compute** and ensure it's **Registered**
54+
55+
<img src="./images/deployment/Subscription_ResourceProvider.png" alt="Resource Provider Registration" width="900">
56+
57+
9. **Deployed Infrastructure** - A successful Document Knowledge Mining Accelerator deployment from the [AVM repository](https://github.com/Azure/bicep-registry-modules/tree/main/avm/ptn/sa/document-knowledge-mining)
58+
59+
## Post-Deployment Steps
60+
61+
### Step 1: Clone the Repository
62+
63+
First, clone this repository to access the post-deployment scripts:
64+
65+
```powershell
66+
git clone https://github.com/microsoft/Document-Knowledge-Mining-Solution-Accelerator.git
67+
```
68+
```powershell
69+
cd Document-Knowledge-Mining-Solution-Accelerator
70+
```
71+
72+
### Step 2: Run the Post-Deployment Script
73+
74+
The post-deployment process is automated through a single PowerShell script that completes the following tasks in approximately 20-30 minutes:
75+
76+
#### What the Script Does:
77+
1. **Configure Kubernetes Infrastructure** - Set up AKS cluster settings and networking
78+
2. **Update Configuration Files** - Generate FQDN, container image paths, and certificate settings
79+
3. **Deploy Kubernetes Components** - Install Cert Manager, Ingress Controller, and application pods
80+
4. **Build and Push Container Images** - Compile and publish application containers to Azure Container Registry
81+
5. **Provide Access Information** - Display the final application URL and next steps
82+
83+
#### Execute the Script:
84+
85+
1. Navigate to the deployment directory:
86+
```powershell
87+
cd .\Deployment\
88+
```
89+
90+
2. **Choose the appropriate command based on your deployment method:**
91+
92+
**If you deployed using custom templates, ARM/Bicep deployments, or `az deployment group` commands:**
93+
```powershell
94+
.\resourcedeployment.ps1 -ResourceGroupName "<your-resource-group-name>"
95+
```
96+
97+
**If you deployed using `azd up` command:**
98+
```powershell
99+
.\resourcedeployment.ps1
100+
```
101+
102+
> **Note**: Replace `<your-resource-group-name>` with the actual name of the resource group containing your deployed Azure resources.
103+
104+
> **💡 Tip**: Since this guide is for AVM deployments, you'll most likely use the first command with the `-ResourceGroupName` parameter.
105+
106+
3. **If you encounter execution policy issues**, use this alternative command:
107+
```powershell
108+
powershell.exe -ExecutionPolicy Bypass -File ".\resourcedeployment.ps1" -ResourceGroupName "<your-resource-group-name>"
109+
```
110+
111+
### Step 3: Provide Required Information
112+
113+
During script execution, you'll be prompted for:
114+
115+
#### Email Address for SSL Certificates
116+
<img src="./images/deployment/Deployment_Input_Param_01.png" width="900" alt="Input Parameters">
117+
118+
- **Purpose**: Used for issuing SSL certificates through [Let's Encrypt](https://letsencrypt.org/)
119+
- **Requirement**: Must be a valid email address
120+
121+
#### Azure Authentication
122+
<img src="./images/deployment/Deployment_Login_02.png" width="900" alt="Azure Login">
123+
124+
- You'll be prompted to authenticate with Azure
125+
- Select the appropriate Azure account
126+
- Ensure you have the required permissions on the target subscription
127+
128+
### Step 4: Deployment Completion
129+
130+
Upon successful completion, you'll see a success message with important information:
131+
132+
<img src="./images/deployment/Deployment_Screen02.png" alt="Deployment Success" width="900">
133+
134+
**🎉 Congratulations!** Your deployment is complete.
135+
136+
**Important**: Save the application URL displayed in the console - you'll need it for data upload and accessing the application.
137+
138+
## Next Steps
139+
140+
### 1. Configure Azure OpenAI Rate Limits
141+
142+
> **⚠️ Critical**: The default deployment creates models with minimal TPM (Tokens Per Minute) limits. You **must** increase these limits for proper performance.
143+
144+
#### Recommended TPM Thresholds
145+
146+
| Model Name | Recommended TPM | Minimum TPM |
147+
|------------------------|----------------|-------------|
148+
| gpt-4.1-mini | 100K TPM | 10K TPM |
149+
| text-embedding-3-large | 200K TPM | 50K TPM |
150+
151+
> **⚠️ Warning**: Insufficient quota will cause failures during document upload and processing. Ensure adequate capacity before proceeding.
152+
153+
#### How to Update TPM Limits:
154+
155+
1. **Navigate to Azure AI Foundry**:
156+
- Go to [Azure AI Foundry](https://ai.azure.com/)
157+
- Select your project
158+
- Go to **Deployments** section
159+
160+
2. **Update Each Model**:
161+
162+
<img src="./images/deployment/Control_Model_TPM000.png" alt="Select Model" width="700">
163+
164+
- Select each deployed model
165+
- Click **Edit deployment**
166+
- Increase the **Tokens per Minute Rate Limit**
167+
168+
<img src="./images/deployment/Control_Model_TPM001.png" alt="Set TPM Limit" width="700">
169+
170+
3. **Apply Changes**: Save the configuration for each model
171+
172+
### 2. Upload and Process Sample Documents
173+
174+
After configuring the TPM limits, upload sample documents:
175+
176+
1. **Navigate to the deployment directory** (if not already there):
177+
```powershell
178+
cd .\Deployment\
179+
```
180+
181+
2. **Execute the upload script** with the URL from the deployment output:
182+
```powershell
183+
.\uploadfiles.ps1 -EndpointUrl https://kmgs<your-dns-name>.<datacenter>.cloudapp.azure.com
184+
```
185+
186+
3. **Alternative execution** (if you encounter policy issues):
187+
```powershell
188+
powershell.exe -ExecutionPolicy Bypass -File ".\uploadfiles.ps1" -EndpointUrl https://kmgs<your-dns-name>.<datacenter>.cloudapp.azure.com
189+
```
190+
191+
### 3. Access Your Application
192+
193+
Once document upload is complete, you can:
194+
- **Access the web application** at the URL provided in the deployment output
195+
- **Start exploring** the knowledge mining capabilities
196+
- **Upload additional documents** through the web interface

docs/DeploymentGuide.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,23 @@ Open PowerShell, change directory where you code cloned, then run the deploy scr
165165
```
166166
cd .\Deployment\
167167
```
168+
169+
#### Choose the appropriate command based on your deployment method:
170+
171+
**If you deployed using `azd up` command:**
168172
```
169173
.\resourcedeployment.ps1
170174
```
171175
176+
**If you deployed using custom templates, ARM/Bicep deployments, or `az deployment group` commands:**
177+
```
178+
.\resourcedeployment.ps1 -ResourceGroupName "<your-resource-group-name>"
179+
```
180+
181+
> **Note:** Replace `<your-resource-group-name>` with the actual name of the resource group containing your deployed Azure resources.
182+
183+
> **💡 Tip**: Since this guide is for azd deployment, you'll typically use the first command without the `-ResourceGroupName` parameter.
184+
172185
If you run into issue with PowerShell script file not being digitally signed, you can execute below command:
173186
174187
```
14.8 KB
Loading
-12.2 KB
Loading
-172 Bytes
Loading

infra/main.bicep

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ resource resourceGroupTags 'Microsoft.Resources/tags@2021-04-01' = {
115115
TemplateName: 'DKM'
116116
Type: enablePrivateNetworking ? 'WAF' : 'Non-WAF'
117117
CreatedBy: createdBy
118+
DeploymentName: deployment().name
118119
}
119120
}
120121
}
@@ -824,7 +825,7 @@ module managedCluster 'br/public:avm/res/container-service/managed-cluster:0.10.
824825
location: solutionLocation
825826
tags: tags
826827
enableTelemetry: enableTelemetry
827-
kubernetesVersion: '1.30.4'
828+
kubernetesVersion: '1.32.7'
828829
dnsPrefix: 'aks-${solutionSuffix}'
829830
enableRBAC: true
830831
disableLocalAccounts: false

0 commit comments

Comments
 (0)