Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3347912
[#19050] GP Test automation changes
Bangarraju-Microsoft Jun 16, 2025
9350afe
Merge pull request #188 from microsoft/PSL-TS-19050
Prajwal-Microsoft Jun 16, 2025
467b57f
GP Test automation - removed duplicate entries.
Bangarraju-Microsoft Jun 18, 2025
f3a394c
pylint error resolved
Bangarraju-Microsoft Jun 18, 2025
639f16a
linting issues
Bangarraju-Microsoft Jun 18, 2025
47db719
resolved comments
Bangarraju-Microsoft Jun 19, 2025
ab7c81b
lint issues
Bangarraju-Microsoft Jun 19, 2025
dc52712
Pylint issue
Bangarraju-Microsoft Jun 19, 2025
6c11840
Merge pull request #191 from microsoft/PSL-TS-19050
Prajwal-Microsoft Jun 19, 2025
2f0b197
Bug fix(#19567) readme file changes
Bangarraju-Microsoft Jun 20, 2025
99f376c
readme changes
Bangarraju-Microsoft Jun 20, 2025
293b9e0
readme images updated
Bangarraju-Microsoft Jun 20, 2025
32511ed
readme changes
Bangarraju-Microsoft Jun 20, 2025
9ea89a7
readme changes updated
Bangarraju-Microsoft Jun 20, 2025
551e069
readme changes
Bangarraju-Microsoft Jun 20, 2025
d03696c
readme changes
Bangarraju-Microsoft Jun 20, 2025
1572e47
readme changes
Bangarraju-Microsoft Jun 20, 2025
bd93d97
readme changes
Bangarraju-Microsoft Jun 20, 2025
68914f0
readme changes
Bangarraju-Microsoft Jun 20, 2025
0fa887e
deleted unwanted images
Bangarraju-Microsoft Jun 20, 2025
7a1da47
readme changes
Bangarraju-Microsoft Jun 20, 2025
0c824f4
readme change
Bangarraju-Microsoft Jun 20, 2025
bab1203
docs: Update steps for DeploymentGuide.md
Prajwal-Microsoft Jun 23, 2025
c07fcd7
Merge pull request #195 from microsoft/PSL-Bug-19567
Prajwal-Microsoft Jun 23, 2025
17d65a2
feat: Removed local build from preprovision and added as part of post…
Prajwal-Microsoft Jun 25, 2025
ff4e5b7
Merge branch 'dev' of https://github.com/microsoft/content-processing…
Prajwal-Microsoft Jun 25, 2025
46bfe0f
docs: Fomating deployment guide
Prajwal-Microsoft Jun 25, 2025
80ffee3
fix: Relativ path issues fixed
Prajwal-Microsoft Jun 25, 2025
5ab8b9c
Merge remote-tracking branch 'origin/cps-rm-local-build' into cps-rm-…
Prajwal-Microsoft Jun 25, 2025
72ff72e
Merge pull request #198 from microsoft/cps-rm-local-build
Roopan-Microsoft Jun 26, 2025
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
7 changes: 0 additions & 7 deletions azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ metadata:
name: content-processinge@1.0

hooks:
preprovision:
posix:
shell: sh
run: timestamp=$(date +"%Y%m%d-%H%M%S"); logFile="azd_preprovision_$timestamp.log"; sed -i 's/\r$//' ./infra/scripts/docker-build.sh; ./infra/scripts/docker-build.sh "$AZURE_SUBSCRIPTION_ID" "$AZURE_ENV_NAME" "$AZURE_LOCATION" "$AZURE_RESOURCE_GROUP" "$USE_LOCAL_BUILD" "$AZURE_ENV_IMAGETAG" 2>&1 | tee "$logFile"
windows:
shell: pwsh
run: $timestamp = Get-Date -Format "yyyyMMdd-HHmmss"; $logFile = "azd_preprovision_$timestamp.log"; ./infra/scripts/docker-build.ps1 $env:AZURE_SUBSCRIPTION_ID $env:AZURE_ENV_NAME $env:AZURE_LOCATION $env:AZURE_RESOURCE_GROUP $env:USE_LOCAL_BUILD $env:AZURE_ENV_IMAGETAG *>&1 | Tee-Object -FilePath $logFile
postprovision:
posix:
shell: sh
Expand Down
1 change: 0 additions & 1 deletion docs/CustomizingAzdParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ By default this template will use the environment name as the prefix to prevent
| `AZURE_ENV_MODEL_NAME` | string | `gpt-4o` | Specifies the GPT model name (allowed values: `gpt-4o`).
| `AZURE_ENV_MODEL_VERSION` | string | `2024-08-06` | Specifies the GPT model version (allowed values: `2024-08-06`). |
| `AZURE_ENV_MODEL_CAPACITY` | integer | `30` | Sets the model capacity (choose based on your subscription's available GPT capacity). |
| `USE_LOCAL_BUILD` | boolean | `false` | Indicates whether to use a local container build for deployment. |
| `AZURE_ENV_IMAGETAG` | boolean | `latest` | Set the Image tag Like (allowed values: latest, dev, hotfix) |
| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | `<Existing Workspace Id>` | Reuses an existing Log Analytics Workspace instead of provisioning a new one. |

Expand Down
39 changes: 18 additions & 21 deletions docs/DeploymentGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,40 +173,37 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
- This deployment will take *4-6 minutes* to provision the resources in your account and set up the solution with sample data.
- If you encounter an error or timeout during deployment, changing the location may help, as there could be availability constraints for the resources.

5. Once the deployment has completed successfully, open the [Azure Portal](https://portal.azure.com/), go to the deployed resource group, find the App Service, and get the app URL from `Default domain`.
5. Once the deployment has completed successfully:
> Please check the terminal or console output for details of the successful deployment. It will display the Name, Endpoint (Application URL), and Azure Portal URL for both the Web and API Azure Container Apps.

6. If you are done trying out the application, you can delete the resources by running `azd down`.
![](./images/cp-post-deployment.png)

### Publishing Local Build Container to Azure Container Registry
- You can find the Azure portal link in the screenshot above. Click on it to navigate to the corresponding resource group in the Azure portal.

If you need to rebuild the source code and push the updated container to the deployed Azure Container Registry, follow these steps:
> #### Important Note : Before accessing the application, ensure that all **[Post Deployment Steps](#post-deployment-steps)** are fully completed, as they are critical for the proper configuration of **Data Ingestion** and **Authentication** functionalities.

1. Set the environment variable `USE_LOCAL_BUILD` to `True`:
7. If you are done trying out the application, you can delete the resources by running `azd down`.

## Post Deployment Steps
1. Optional: Publishing Local Build Container to Azure Container Registry

If you need to rebuild the source code and push the updated container to the deployed Azure Container Registry, follow these steps:

- **Linux/macOS**:
```bash
export USE_LOCAL_BUILD=True
cd ./infra/scripts/
./docker-build.sh
```

- **Windows (PowerShell)**:
```powershell
$env:USE_LOCAL_BUILD = $true
cd .\infra\scripts\
.\docker-build.ps1
```
2. Run the `az login` command
```bash
az login
```

3. Run the `azd up` command again to rebuild and push the updated container:
```bash
azd up
```

This will rebuild the source code, package it into a container, and push it to the Azure Container Registry associated with your deployment.

## Post Deployment Steps
This will create a new Azure Container Registry, rebuild the source code, package it into a container, and push it to the Container Registry created.

1. **Register Schema Files**
2. **Register Schema Files**

> Want to customize the schemas for your own documents? [Learn more about adding your own schemas here.](./CustomizeSchemaData.md)

Expand Down Expand Up @@ -236,7 +233,7 @@ This will rebuild the source code, package it into a container, and push it to t
- **Verify Results**
![schema file registration](./images/SchemaFileRegistration.png)

2. **Import Sample Data**
3. **Import Sample Data**
- Grab the Schema IDs for Invoice and Property Damage Claim Form's Schema from first step
- Move to the folder location to samples in ContentProcessorApi - [/src/ContentProcessorApi/samples/](/src/ContentProcessorApi/samples/)
- Execute the script with Schema IDs
Expand Down
Binary file added docs/images/cp-post-deployment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 1 addition & 7 deletions infra/container_app/deploy_container_app.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ param probes array = []
param allowedOrigins array = []
param minReplicas int = 1
param maxReplicas int = 1
param useLocalBuild string = 'false'

//Todo: Add Appconfig endpoint as Env variable

Expand All @@ -34,12 +33,7 @@ resource processorContainerApp 'Microsoft.App/containerApps@2024-03-01' = {
environmentId: containerEnvId
workloadProfileName: 'Consumption'
configuration:{
registries: useLocalBuild == 'true' ? [
{
server: azureContainerRegistry
identity: managedIdentityId
}
] : null
registries: null
ingress: enableIngress ? {
external: true
transport: 'auto'
Expand Down
4 changes: 0 additions & 4 deletions infra/container_app/deploy_container_app_api_web.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ param maxReplicaContainerWeb int = 1
// Container related params
param azureContainerRegistry string
param containerRegistryReaderId string
param useLocalBuild string = 'false'
param imageTag string

var abbrs = loadJsonContent('../abbreviations.json')
Expand Down Expand Up @@ -88,7 +87,6 @@ module containerApp 'deploy_container_app.bicep' = {
enableIngress: false
minReplicas: minReplicaContainerApp
maxReplicas: maxReplicaContainerApp
useLocalBuild: useLocalBuild
}
}

Expand All @@ -112,7 +110,6 @@ module containerAppApi 'deploy_container_app.bicep' = {
probes: probes
minReplicas: minReplicaContainerApi
maxReplicas: maxReplicaContainerApi
useLocalBuild: useLocalBuild
}
}

Expand Down Expand Up @@ -154,7 +151,6 @@ module containerAppWeb 'deploy_container_app.bicep' = {
]
minReplicas: minReplicaContainerWeb
maxReplicas: maxReplicaContainerWeb
useLocalBuild: useLocalBuild
}
}

Expand Down
16 changes: 16 additions & 0 deletions infra/deploy_container_registry.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ param location string = resourceGroup().location

@description('Provide a tier of your Azure Container Registry.')
param acrSku string = 'Basic'

@description('List of Principal Ids to which ACR pull role assignment is required')
param acrPullPrincipalIds array = []

resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-09-01' = {
name: containerNameCleaned
Expand All @@ -26,6 +29,19 @@ resource containerRegistry 'Microsoft.ContainerRegistry/registries@2021-09-01' =
zoneRedundancy: 'Disabled'
}
}

// Add Role assignments for required principal id's
resource acrPullRoleAssignments 'Microsoft.Authorization/roleAssignments@2022-04-01' = [for principalId in acrPullPrincipalIds: {
name: guid(principalId, 'acrpull')
scope: containerRegistry
properties: {
roleDefinitionId: subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions',
'7f951dda-4ed3-4680-a7ca-43fe172d538d'
)
principalId: principalId
}
}]

output createdAcrName string = containerNameCleaned
output createdAcrId string = containerRegistry.id
Expand Down
14 changes: 0 additions & 14 deletions infra/deploy_role_assignments.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ param storagePrincipalId string // Resource ID of the Storage account
param aiServiceCUId string // Resource ID of the Azure AI Content Understanding Service
param aiServiceId string // Resource ID of the Azure Open AI service

param containerRegistryReaderPrincipalId string

resource appConfigDataReader 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
scope: resourceGroup()
name: '516239f1-63e1-4d78-a4de-a74fb236a071'
Expand Down Expand Up @@ -130,15 +128,3 @@ resource cognitiveServicesUserRoleAssignment 'Microsoft.Authorization/roleAssign
principalType: 'ServicePrincipal'
}
}

resource acrPullRoleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(containerRegistryReaderPrincipalId, 'acrpull')
scope: resourceGroup()
properties: {
roleDefinitionId: subscriptionResourceId(
'Microsoft.Authorization/roleDefinitions',
'7f951dda-4ed3-4680-a7ca-43fe172d538d'
) // AcrPull role
principalId: containerRegistryReaderPrincipalId
}
}
44 changes: 23 additions & 21 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ param secondaryLocation string = 'EastUs2'
type: 'location'
}
})
param contentUnderstandingLocation string
param contentUnderstandingLocation string = 'WestUS'

@metadata({azd: {
type: 'location'
usageName: [
'OpenAI.GlobalStandard.gpt-4o,100'
]
}
})
param aiDeploymentsLocation string

@minLength(1)
@description('GPT model deployment type:')
Expand All @@ -36,8 +45,6 @@ param gptModelName string = 'gpt-4o'
@description('Version of the GPT model to deploy:')
param gptModelVersion string = '2024-08-06'

//var gptModelVersion = '2024-02-15-preview'

@minValue(10)
@description('Capacity of the GPT deployment:')
// You can increase this, but capacity is limited per model/region, so you will get errors if you go over
Expand All @@ -62,9 +69,6 @@ param minReplicaContainerWeb int = 1
@description('Maximum number of replicas to be added for Container Web App')
param maxReplicaContainerWeb int = 1

@description('Set this flag to true only if you are deplpoying from Local')
param useLocalBuild string = 'false'

@description('Optional: Existing Log Analytics Workspace Resource ID')
param existingLogAnalyticsWorkspaceId string = ''

Expand All @@ -76,9 +80,6 @@ var resourceGroupLocation = resourceGroup().location
// Load the abbrevations file required to name the azure resources.
var abbrs = loadJsonContent('./abbreviations.json')

// Convert input to lowercase
var useLocalBuildLower = toLower(useLocalBuild)

// ========== Managed Identity ========== //
module managedIdentityModule 'deploy_managed_identity.bicep' = {
name: 'deploy_managed_identity'
Expand Down Expand Up @@ -111,13 +112,13 @@ module applicationInsights 'deploy_app_insights.bicep' = {
}
}

// ========== Container Registry ========== //
module containerRegistry 'deploy_container_registry.bicep' = {
name: 'deploy_container_registry'
params: {
environmentName: environmentName
}
}
// // ========== Container Registry ========== //
// module containerRegistry 'deploy_container_registry.bicep' = {
// name: 'deploy_container_registry'
// params: {
// environmentName: environmentName
// }
// }

// ========== Storage Account ========== //
module storage 'deploy_storage_account.bicep' = {
Expand All @@ -134,7 +135,7 @@ module aifoundry 'deploy_ai_foundry.bicep' = {
name: 'deploy_ai_foundry'
params: {
solutionName: solutionPrefix
solutionLocation: resourceGroupLocation
solutionLocation: aiDeploymentsLocation
cuLocation: contentUnderstandingLocation
deploymentType: deploymentType
gptModelName: gptModelName
Expand Down Expand Up @@ -173,7 +174,6 @@ module containerApps './container_app/deploy_container_app_api_web.bicep' = {
maxReplicaContainerApi: maxReplicaContainerApi
minReplicaContainerWeb: minReplicaContainerWeb
maxReplicaContainerWeb: maxReplicaContainerWeb
useLocalBuild: 'false'
imageTag: 'latest'
}
}
Expand Down Expand Up @@ -221,7 +221,6 @@ module roleAssignments 'deploy_role_assignments.bicep' = {
containerAppPrincipalId: containerApps.outputs.containerAppPrincipalId
aiServiceCUId: aifoundry.outputs.aiServicesCuId
aiServiceId: aifoundry.outputs.aiServicesId
containerRegistryReaderPrincipalId: containerAppEnv.outputs.containerRegistryReaderPrincipalId
}
}

Expand All @@ -230,7 +229,7 @@ module updateContainerApp './container_app/deploy_container_app_api_web.bicep' =
params: {
solutionName: solutionPrefix
location: secondaryLocation
azureContainerRegistry: useLocalBuildLower == 'true' ? containerRegistry.outputs.acrEndpoint : containerImageEndPoint
azureContainerRegistry: containerImageEndPoint
appConfigEndPoint: appconfig.outputs.appConfigEndpoint
containerAppEnvId: containerAppEnv.outputs.containerEnvId
containerRegistryReaderId: containerAppEnv.outputs.containerRegistryReaderId
Expand All @@ -242,7 +241,6 @@ module updateContainerApp './container_app/deploy_container_app_api_web.bicep' =
maxReplicaContainerApi: maxReplicaContainerApi
minReplicaContainerWeb: minReplicaContainerWeb
maxReplicaContainerWeb: maxReplicaContainerWeb
useLocalBuild: useLocalBuildLower
imageTag: imageTag
}
dependsOn: [roleAssignments]
Expand All @@ -251,4 +249,8 @@ module updateContainerApp './container_app/deploy_container_app_api_web.bicep' =
output CONTAINER_WEB_APP_NAME string = containerApps.outputs.containerAppWebName
output CONTAINER_API_APP_NAME string = containerApps.outputs.containerAppApiName
output CONTAINER_WEB_APP_FQDN string = containerApps.outputs.containweAppWebEndPoint
output CONTAINER_APP_NAME string = containerApps.outputs.containerAppName
output CONTAINER_API_APP_FQDN string = containerApps.outputs.containweAppApiEndPoint
output CONTAINER_APP_USER_IDENTITY_ID string = containerAppEnv.outputs.containerRegistryReaderId
output CONTAINER_APP_USER_PRINCIPAL_ID string = containerAppEnv.outputs.containerRegistryReaderPrincipalId
output AZURE_ENV_IMAGETAG string = imageTag
12 changes: 0 additions & 12 deletions infra/main.bicepparam

This file was deleted.

Loading
Loading