Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion IMPLEMENTATION_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ role-definition ID used by the template is

The AI Gateway module uses the live `2025-09-01-preview` contracts:

- `Microsoft.ApiManagement/aigateways` with SKU `Premium`
- `Microsoft.ApiManagement/aigateways` (`sku` omitted so the RP defaults to `Standard`)
- `Microsoft.ApiManagement/aigateways/workspaces`
- `Microsoft.ApiManagement/aigateways/workspaces/modelProviders`
- `Microsoft.ApiManagement/aigateways/workspaces/modelProviders/models`
Expand Down
2 changes: 1 addition & 1 deletion infra/ai-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Run the commands in this README from the `infra/ai-gateway/` directory.

[`main.bicep`](main.bicep) is a resource-group-scoped module for an AI Gateway
with Premium SKU. With the default `deployApimGatewayViaBicep: true`, it
(`sku` omitted so the resource provider defaults to `Standard`). With the default `deployApimGatewayViaBicep: true`, it
creates `Microsoft.ApiManagement/aigateways` and `apiKeys/default`.
When monitoring is enabled, it also provisions Log Analytics and a
workspace-based Application Insights component (`AzureMonitorWorkspaceIngestionMode: Enabled`).
Expand Down
3 changes: 0 additions & 3 deletions infra/ai-gateway/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ resource aiGateway 'Microsoft.ApiManagement/aigateways@2025-09-01-preview' = if
identity: {
type: 'SystemAssigned'
}
sku: {
name: 'Premium'
}
properties: empty(backendSubnetResourceId)
? {}
: {
Expand Down
5 changes: 1 addition & 4 deletions infra/scripts/manage-ai-gateway-lifecycle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function Find-LiveGateway {
$candidateLines = & az resource list `
--subscription $subscriptionId `
--resource-type Microsoft.ApiManagement/aigateways `
--query "[?tags.`"azd-env-name`"=='$environmentName' && sku.name=='Premium'].[name,resourceGroup,location]" `
--query "[?tags.`"azd-env-name`"=='$environmentName'].[name,resourceGroup,location]" `
-o tsv
if ($LASTEXITCODE -ne 0) {
throw "AI Gateway lifecycle error: could not discover AI Gateway resources for azd environment $environmentName."
Expand Down Expand Up @@ -274,9 +274,6 @@ function Test-LiveDeleting($Record) {
}

function Assert-LiveOwnership($Record) {
if ($Record.Sku -ne "Premium") {
throw "AI Gateway lifecycle error: refusing $resourceGroup/$gatewayName; expected SKU Premium but found $($Record.Sku)."
}
if ($Record.Owner -ne $environmentName) {
throw "AI Gateway lifecycle error: refusing $resourceGroup/$gatewayName; expected azd-env-name=$environmentName but found $($Record.Owner)."
}
Expand Down
4 changes: 1 addition & 3 deletions infra/scripts/manage-ai-gateway-lifecycle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ discover_live_gateway() {
if ! candidates="$(az resource list \
--subscription "$subscription_id" \
--resource-type Microsoft.ApiManagement/aigateways \
--query "[?tags.\"azd-env-name\"=='${environment_name}' && sku.name=='Premium'].[name,resourceGroup,location]" \
--query "[?tags.\"azd-env-name\"=='${environment_name}'].[name,resourceGroup,location]" \
-o tsv)"; then
fail "could not discover AI Gateway resources for azd environment ${environment_name}."
fi
Expand Down Expand Up @@ -354,8 +354,6 @@ live_is_deleting() {
}

validate_live_ownership() {
[ "$live_sku" = "Premium" ] ||
fail "refusing ${resource_group}/${gateway_name}; expected SKU Premium but found ${live_sku:-unknown}."
[ "$live_owner" = "$environment_name" ] ||
fail "refusing ${resource_group}/${gateway_name}; expected azd-env-name=${environment_name} but found ${live_owner:-missing}."
if [ -n "$live_location" ] && [ "$live_location" != "null" ]; then
Expand Down
6 changes: 3 additions & 3 deletions tests/test-ai-gateway-model-registration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ done
gateway_sku="$(jq -r '
.resources[]
| select(.type == "Microsoft.ApiManagement/aigateways")
| .sku.name
| .sku
' "$compiled_template")"
if [ "$gateway_sku" != "Premium" ]; then
echo "AI Gateway must use the live RP Premium SKU." >&2
if [ "$gateway_sku" != "null" ]; then
echo "AI Gateway must omit sku so the RP applies its default SKU." >&2
echo "Actual: $gateway_sku" >&2
exit 1
fi
Expand Down
8 changes: 4 additions & 4 deletions tests/test-apim-lifecycle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ case "$uri" in
if [ -n "$query" ]; then
printf '%s|%s|%s|%s|%s\n' \
"$(read_state provisioning_state Succeeded)" \
"$(read_state sku Premium)" \
"$(read_state sku Standard)" \
"$(read_state owner "$environment_name")" \
"$location" \
"$(read_state target_state null)"
Expand Down Expand Up @@ -197,7 +197,7 @@ new_case() {
case_dir="$temp_root/$name"
mkdir -p "$case_dir"
printf '0' > "$case_dir/live"
printf 'Premium' > "$case_dir/sku"
printf 'Standard' > "$case_dir/sku"
printf 'tues' > "$case_dir/owner"
printf 'Succeeded' > "$case_dir/provisioning_state"
output_file="$case_dir/output"
Expand Down Expand Up @@ -389,7 +389,6 @@ assert_contains "$marker_file" "state=pending"
for token in \
"2025-09-01-preview" \
"Microsoft.ApiManagement/aigateways" \
"Premium" \
"azd-env-name" \
"FailedIdentityOperation" \
"ActivationFailed" \
Expand All @@ -402,7 +401,8 @@ done
for legacy_contract in \
"Microsoft.ApiManagement/service" \
"deletedservices" \
"AIGateway"; do
"AIGateway" \
"Premium"; do
assert_not_contains "$lifecycle_script" "$legacy_contract"
assert_not_contains "$powershell_script" "$legacy_contract"
done
Expand Down
Loading