Skip to content

Commit 447c317

Browse files
authored
Merge pull request #3 from hunterjam/psl-contentgen
Include GPT-Image-1.5, update local dev scripts and align output variable names
2 parents 2ce1264 + c88ac98 commit 447c317

10 files changed

Lines changed: 441 additions & 95 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ AZURE_CLIENT_ID=
99
# =============================================================================
1010
# Azure OpenAI Configuration
1111
# =============================================================================
12+
AI_FOUNDRY_RESOURCE_ID=/subscriptions/your-subscription-id/resourceGroups/your-resource-group/providers/Microsoft.CognitiveServices/accounts/your-aif-account
13+
AZURE_EXISTING_AI_PROJECT_RESOURCE_ID=/subscriptions/your-subscription-id/resourceGroups/your-resource-group/providers/Microsoft.CognitiveServices/accounts/your-aif-account/projects/your-project-name
1214
# Your Azure OpenAI endpoint (e.g., https://your-resource.openai.azure.com/)
1315
AZURE_OPENAI_ENDPOINT=https://your-openai.openai.azure.com/
1416

content-gen/azure.yaml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,33 @@ hooks:
6060
Write-Host "Web App URL: " -NoNewline
6161
Write-Host "$env:WEB_APP_URL" -ForegroundColor Cyan
6262
Write-Host "Storage Account: " -NoNewline
63-
Write-Host "$env:STORAGE_ACCOUNT_NAME" -ForegroundColor Cyan
63+
Write-Host "$env:AZURE_BLOB_ACCOUNT_NAME" -ForegroundColor Cyan
6464
Write-Host "AI Search Service: " -NoNewline
6565
Write-Host "$env:AI_SEARCH_SERVICE_NAME" -ForegroundColor Cyan
6666
Write-Host "AI Search Index: " -NoNewline
67-
Write-Host "$env:AI_SEARCH_INDEX" -ForegroundColor Cyan
67+
Write-Host "$env:AZURE_AI_SEARCH_PRODUCTS_INDEX" -ForegroundColor Cyan
6868
Write-Host "AI Service Location: " -NoNewline
6969
Write-Host "$env:AI_SERVICE_LOCATION" -ForegroundColor Cyan
7070
7171
# Run post-deployment role assignments
7272
Write-Host ""
7373
Write-Host "===== Running Post-Deployment Configuration =====" -ForegroundColor Yellow
7474
75+
Write-Host "Checking Azure authentication..."
76+
77+
# Check if user is logged in, if not prompt for login
78+
$signedUserId = az ad signed-in-user show --query id -o tsv 2>$null
79+
if (-not $signedUserId) {
80+
Write-Host "Not logged in to Azure. Please authenticate..." -ForegroundColor Yellow
81+
az login --use-device-code
82+
if ($LASTEXITCODE -ne 0) {
83+
Write-Host "Azure login failed. Cannot proceed without authentication." -ForegroundColor Red
84+
exit 1
85+
}
86+
$signedUserId = az ad signed-in-user show --query id -o tsv 2>$null
87+
}
7588
# Assign Cosmos DB role to current user
7689
Write-Host "Assigning Cosmos DB Data Contributor role..."
77-
$signedUserId = az ad signed-in-user show --query id -o tsv
7890
az cosmosdb sql role assignment create --resource-group $env:RESOURCE_GROUP_NAME --account-name $env:COSMOSDB_ACCOUNT_NAME --role-definition-id "00000000-0000-0000-0000-000000000002" --principal-id $signedUserId --scope "/" 2>$null
7991
if ($LASTEXITCODE -eq 0) {
8092
Write-Host " Cosmos DB role assigned successfully" -ForegroundColor Green
@@ -132,18 +144,33 @@ hooks:
132144
echo "===== Provision Complete ====="
133145
echo ""
134146
echo "Web App URL: $WEB_APP_URL"
135-
echo "Storage Account: $STORAGE_ACCOUNT_NAME"
147+
echo "Storage Account: $AZURE_BLOB_ACCOUNT_NAME"
136148
echo "AI Search Service: $AI_SEARCH_SERVICE_NAME"
137-
echo "AI Search Index: $AI_SEARCH_INDEX"
149+
echo "AI Search Index: $AZURE_AI_SEARCH_PRODUCTS_INDEX"
138150
echo "AI Service Location: $AI_SERVICE_LOCATION"
139151
140152
# Run post-deployment role assignments
141153
echo ""
142154
echo "===== Running Post-Deployment Configuration ====="
143155
156+
echo "Checking Azure authentication..."
157+
158+
# Check if user is logged in, if not prompt for login
159+
if ! signed_user_id=$(az ad signed-in-user show --query id -o tsv 2>/dev/null) || [ -z "$signed_user_id" ]; then
160+
echo "Not logged in to Azure. Please authenticate..."
161+
if ! az login --use-device-code; then
162+
echo "Azure login failed. Cannot proceed without authentication."
163+
exit 1
164+
fi
165+
if ! signed_user_id=$(az ad signed-in-user show --query id -o tsv 2>/dev/null) || [ -z "$signed_user_id" ]; then
166+
echo "Failed to authenticate. Please run 'az login' manually before deployment."
167+
exit 1
168+
fi
169+
fi
170+
144171
# Assign Cosmos DB role to current user
145172
echo "Assigning Cosmos DB Data Contributor role..."
146-
signed_user_id=$(az ad signed-in-user show --query id -o tsv)
173+
147174
az cosmosdb sql role assignment create \
148175
--resource-group "$RESOURCE_GROUP_NAME" \
149176
--account-name "$COSMOSDB_ACCOUNT_NAME" \

content-gen/docs/LOCAL_DEPLOYMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ If you have an existing Azure deployment with `azd`:
5454

5555
1. Copy the environment template:
5656
```bash
57-
cp .env.template .env
57+
cp .env.sample .env
5858
```
5959

6060
2. Edit `.env` with your Azure resource values (see [Environment Variables Reference](#environment-variables-reference) below)

content-gen/infra/main.bicep

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ param gptModelName string = 'gpt-5.1'
5454
@description('Optional. Version of the GPT model to deploy.')
5555
param gptModelVersion string = '2025-11-13'
5656

57-
@description('Optional. Image model to deploy: gpt-image-1, dall-e-3, or none to skip.')
57+
@description('Optional. Image model to deploy: gpt-image-1, gpt-image-1.5, dall-e-3, or none to skip.')
5858
@allowed([
5959
'gpt-image-1'
60+
'gpt-image-1.5'
6061
'dall-e-3'
6162
'none'
6263
])
@@ -268,6 +269,11 @@ var imageModelConfig = {
268269
version: '2025-04-15'
269270
sku: 'GlobalStandard'
270271
}
272+
'gpt-image-1.5': {
273+
name: 'gpt-image-1.5'
274+
version: '2025-12-16'
275+
sku: 'GlobalStandard'
276+
}
271277
'dall-e-3': {
272278
name: 'dall-e-3'
273279
version: '3.0'
@@ -501,6 +507,11 @@ module aiFoundryAiServices 'br/public:avm/res/cognitive-services/account:0.14.0'
501507
principalId: userAssignedIdentity.outputs.principalId
502508
principalType: 'ServicePrincipal'
503509
}
510+
{
511+
roleDefinitionIdOrName: '53ca6127-db72-4b80-b1b0-d745d6d5456d' // Azure AI User for deployer
512+
principalId: deployer().objectId
513+
principalType: 'User'
514+
}
504515
]
505516
diagnosticSettings: enableMonitoring ? [{ workspaceResourceId: logAnalyticsWorkspaceResourceId }] : null
506517
publicNetworkAccess: enablePrivateNetworking ? 'Disabled' : 'Enabled'
@@ -892,25 +903,28 @@ output APP_SERVICE_NAME string = webSite.outputs.name
892903
output WEB_APP_URL string = 'https://${webSite.outputs.name}.azurewebsites.net'
893904

894905
@description('Contains Storage Account Name')
895-
output STORAGE_ACCOUNT_NAME string = storageAccount.outputs.name
906+
output AZURE_BLOB_ACCOUNT_NAME string = storageAccount.outputs.name
896907

897908
@description('Contains Product Images Container')
898-
output STORAGE_PRODUCT_IMAGES_CONTAINER string = productImagesContainer
909+
output AZURE_BLOB_PRODUCT_IMAGES_CONTAINER string = productImagesContainer
899910

900911
@description('Contains Generated Images Container')
901-
output STORAGE_GENERATED_IMAGES_CONTAINER string = generatedImagesContainer
912+
output AZURE_BLOB_GENERATED_IMAGES_CONTAINER string = generatedImagesContainer
902913

903914
@description('Contains CosmosDB Account Name')
904915
output COSMOSDB_ACCOUNT_NAME string = cosmosDB.outputs.name
905916

917+
@description('Contains CosmosDB Endpoint URL')
918+
output AZURE_COSMOS_ENDPOINT string = 'https://cosmos-${solutionSuffix}.documents.azure.com:443/'
919+
906920
@description('Contains CosmosDB Database Name')
907-
output COSMOSDB_DATABASE_NAME string = cosmosDBDatabaseName
921+
output AZURE_COSMOS_DATABASE_NAME string = cosmosDBDatabaseName
908922

909923
@description('Contains CosmosDB Products Container')
910-
output COSMOSDB_PRODUCTS_CONTAINER string = cosmosDBProductsContainer
924+
output AZURE_COSMOS_PRODUCTS_CONTAINER string = cosmosDBProductsContainer
911925

912926
@description('Contains CosmosDB Conversations Container')
913-
output COSMOSDB_CONVERSATIONS_CONTAINER string = cosmosDBConversationsContainer
927+
output AZURE_COSMOS_CONVERSATIONS_CONTAINER string = cosmosDBConversationsContainer
914928

915929
@description('Contains Resource Group Name')
916930
output RESOURCE_GROUP_NAME string = resourceGroup().name
@@ -924,18 +938,36 @@ output AI_FOUNDRY_RG_NAME string = aiFoundryAiServicesResourceGroupName
924938
@description('Contains AI Foundry Resource ID')
925939
output AI_FOUNDRY_RESOURCE_ID string = useExistingAiFoundryAiProject ? '' : aiFoundryAiServices!.outputs.resourceId
926940

941+
@description('Contains existing AI project resource ID.')
942+
output AZURE_EXISTING_AI_PROJECT_RESOURCE_ID string = azureExistingAIProjectResourceId
943+
944+
@description('Contains AI Search Service Endpoint URL')
945+
output AZURE_AI_SEARCH_ENDPOINT string = 'https://${aiSearch.outputs.name}.search.windows.net/'
946+
927947
@description('Contains AI Search Service Name')
928948
output AI_SEARCH_SERVICE_NAME string = aiSearch.outputs.name
929949

930-
@description('Contains AI Search Index')
931-
output AI_SEARCH_INDEX string = azureSearchIndex
950+
@description('Contains AI Search Product Index')
951+
output AZURE_AI_SEARCH_PRODUCTS_INDEX string = azureSearchIndex
952+
953+
@description('Contains AI Search Image Index')
954+
output AZURE_AI_SEARCH_IMAGE_INDEX string = 'product-images'
955+
956+
@description('Contains Azure OpenAI endpoint URL')
957+
output AZURE_OPENAI_ENDPOINT string = 'https://${aiFoundryAiServicesResourceName}.openai.azure.com/'
932958

933959
@description('Contains GPT Model')
934-
output AZURE_OPENAI_MODEL string = gptModelName
960+
output AZURE_OPENAI_GPT_MODEL string = gptModelName
935961

936962
@description('Contains Image Model (empty if none selected)')
937963
output AZURE_OPENAI_IMAGE_MODEL string = imageModelConfig[imageModelChoice].name
938964

965+
@description('Contains Azure OpenAI GPT/Image endpoint URL (empty if no image model selected)')
966+
output AZURE_OPENAI_GPT_IMAGE_ENDPOINT string = imageModelChoice != 'none' ? 'https://${aiFoundryAiServicesResourceName}.openai.azure.com/' : ''
967+
968+
@description('Contains Azure OpenAI API Version')
969+
output AZURE_OPENAI_API_VERSION string = azureOpenaiAPIVersion
970+
939971
@description('Contains OpenAI Resource')
940972
output AZURE_OPENAI_RESOURCE string = aiFoundryAiServicesResourceName
941973

content-gen/infra/main.json

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"_generator": {
77
"name": "bicep",
88
"version": "0.39.26.7824",
9-
"templateHash": "8571608347823667459"
9+
"templateHash": "16137819665558470436"
1010
},
1111
"name": "Intelligent Content Generation Accelerator",
1212
"description": "Solution Accelerator for multimodal marketing content generation using Microsoft Agent Framework.\n"
@@ -99,11 +99,12 @@
9999
"defaultValue": "gpt-image-1",
100100
"allowedValues": [
101101
"gpt-image-1",
102+
"gpt-image-1.5",
102103
"dall-e-3",
103104
"none"
104105
],
105106
"metadata": {
106-
"description": "Optional. Image model to deploy: gpt-image-1, dall-e-3, or none to skip."
107+
"description": "Optional. Image model to deploy: gpt-image-1, gpt-image-1.5, dall-e-3, or none to skip."
107108
}
108109
},
109110
"azureOpenaiAPIVersion": {
@@ -194,7 +195,7 @@
194195
},
195196
"acrName": {
196197
"type": "string",
197-
"defaultValue": "contentgenacrmaint",
198+
"defaultValue": "contentgencontainerreg",
198199
"metadata": {
199200
"description": "Required. The existing Container Registry name (without .azurecr.io). Must contain pre-built images: content-gen-app and content-gen-api."
200201
}
@@ -334,6 +335,11 @@
334335
"version": "2025-04-15",
335336
"sku": "GlobalStandard"
336337
},
338+
"gpt-image-1.5": {
339+
"name": "gpt-image-1.5",
340+
"version": "2025-12-16",
341+
"sku": "GlobalStandard"
342+
},
337343
"dall-e-3": {
338344
"name": "dall-e-3",
339345
"version": "3.0",
@@ -10858,6 +10864,11 @@
1085810864
"roleDefinitionIdOrName": "5e0bd9bd-7b93-4f28-af87-19fc36ad61bd",
1085910865
"principalId": "[reference('userAssignedIdentity').outputs.principalId.value]",
1086010866
"principalType": "ServicePrincipal"
10867+
},
10868+
{
10869+
"roleDefinitionIdOrName": "53ca6127-db72-4b80-b1b0-d745d6d5456d",
10870+
"principalId": "[deployer().objectId]",
10871+
"principalType": "User"
1086110872
}
1086210873
]
1086310874
},
@@ -33461,21 +33472,21 @@
3346133472
},
3346233473
"value": "[format('https://{0}.azurewebsites.net', reference('webSite').outputs.name.value)]"
3346333474
},
33464-
"STORAGE_ACCOUNT_NAME": {
33475+
"AZURE_BLOB_ACCOUNT_NAME": {
3346533476
"type": "string",
3346633477
"metadata": {
3346733478
"description": "Contains Storage Account Name"
3346833479
},
3346933480
"value": "[reference('storageAccount').outputs.name.value]"
3347033481
},
33471-
"STORAGE_PRODUCT_IMAGES_CONTAINER": {
33482+
"AZURE_BLOB_PRODUCT_IMAGES_CONTAINER": {
3347233483
"type": "string",
3347333484
"metadata": {
3347433485
"description": "Contains Product Images Container"
3347533486
},
3347633487
"value": "[variables('productImagesContainer')]"
3347733488
},
33478-
"STORAGE_GENERATED_IMAGES_CONTAINER": {
33489+
"AZURE_BLOB_GENERATED_IMAGES_CONTAINER": {
3347933490
"type": "string",
3348033491
"metadata": {
3348133492
"description": "Contains Generated Images Container"
@@ -33489,21 +33500,28 @@
3348933500
},
3349033501
"value": "[reference('cosmosDB').outputs.name.value]"
3349133502
},
33492-
"COSMOSDB_DATABASE_NAME": {
33503+
"AZURE_COSMOS_ENDPOINT": {
33504+
"type": "string",
33505+
"metadata": {
33506+
"description": "Contains CosmosDB Endpoint URL"
33507+
},
33508+
"value": "[format('https://cosmos-{0}.documents.azure.com:443/', variables('solutionSuffix'))]"
33509+
},
33510+
"AZURE_COSMOS_DATABASE_NAME": {
3349333511
"type": "string",
3349433512
"metadata": {
3349533513
"description": "Contains CosmosDB Database Name"
3349633514
},
3349733515
"value": "[variables('cosmosDBDatabaseName')]"
3349833516
},
33499-
"COSMOSDB_PRODUCTS_CONTAINER": {
33517+
"AZURE_COSMOS_PRODUCTS_CONTAINER": {
3350033518
"type": "string",
3350133519
"metadata": {
3350233520
"description": "Contains CosmosDB Products Container"
3350333521
},
3350433522
"value": "[variables('cosmosDBProductsContainer')]"
3350533523
},
33506-
"COSMOSDB_CONVERSATIONS_CONTAINER": {
33524+
"AZURE_COSMOS_CONVERSATIONS_CONTAINER": {
3350733525
"type": "string",
3350833526
"metadata": {
3350933527
"description": "Contains CosmosDB Conversations Container"
@@ -33538,21 +33556,49 @@
3353833556
},
3353933557
"value": "[if(variables('useExistingAiFoundryAiProject'), '', reference('aiFoundryAiServices').outputs.resourceId.value)]"
3354033558
},
33559+
"AZURE_EXISTING_AI_PROJECT_RESOURCE_ID": {
33560+
"type": "string",
33561+
"metadata": {
33562+
"description": "Contains existing AI project resource ID."
33563+
},
33564+
"value": "[parameters('azureExistingAIProjectResourceId')]"
33565+
},
33566+
"AZURE_AI_SEARCH_ENDPOINT": {
33567+
"type": "string",
33568+
"metadata": {
33569+
"description": "Contains AI Search Service Endpoint URL"
33570+
},
33571+
"value": "[format('https://{0}.search.windows.net/', reference('aiSearch').outputs.name.value)]"
33572+
},
3354133573
"AI_SEARCH_SERVICE_NAME": {
3354233574
"type": "string",
3354333575
"metadata": {
3354433576
"description": "Contains AI Search Service Name"
3354533577
},
3354633578
"value": "[reference('aiSearch').outputs.name.value]"
3354733579
},
33548-
"AI_SEARCH_INDEX": {
33580+
"AZURE_AI_SEARCH_PRODUCTS_INDEX": {
3354933581
"type": "string",
3355033582
"metadata": {
33551-
"description": "Contains AI Search Index"
33583+
"description": "Contains AI Search Product Index"
3355233584
},
3355333585
"value": "[variables('azureSearchIndex')]"
3355433586
},
33555-
"AZURE_OPENAI_MODEL": {
33587+
"AZURE_AI_SEARCH_IMAGE_INDEX": {
33588+
"type": "string",
33589+
"metadata": {
33590+
"description": "Contains AI Search Image Index"
33591+
},
33592+
"value": "product-images"
33593+
},
33594+
"AZURE_OPENAI_ENDPOINT": {
33595+
"type": "string",
33596+
"metadata": {
33597+
"description": "Contains Azure OpenAI endpoint URL"
33598+
},
33599+
"value": "[format('https://{0}.openai.azure.com/', variables('aiFoundryAiServicesResourceName'))]"
33600+
},
33601+
"AZURE_OPENAI_GPT_MODEL": {
3355633602
"type": "string",
3355733603
"metadata": {
3355833604
"description": "Contains GPT Model"
@@ -33566,6 +33612,20 @@
3356633612
},
3356733613
"value": "[variables('imageModelConfig')[parameters('imageModelChoice')].name]"
3356833614
},
33615+
"AZURE_OPENAI_GPT_IMAGE_ENDPOINT": {
33616+
"type": "string",
33617+
"metadata": {
33618+
"description": "Contains Azure OpenAI GPT/Image endpoint URL (empty if no image model selected)"
33619+
},
33620+
"value": "[if(not(equals(parameters('imageModelChoice'), 'none')), format('https://{0}.openai.azure.com/', variables('aiFoundryAiServicesResourceName')), '')]"
33621+
},
33622+
"AZURE_OPENAI_API_VERSION": {
33623+
"type": "string",
33624+
"metadata": {
33625+
"description": "Contains Azure OpenAI API Version"
33626+
},
33627+
"value": "[parameters('azureOpenaiAPIVersion')]"
33628+
},
3356933629
"AZURE_OPENAI_RESOURCE": {
3357033630
"type": "string",
3357133631
"metadata": {

0 commit comments

Comments
 (0)