Skip to content

Azure deploy: use a Foundry account that already exists (FOUNDRY_ACCOUNT_EXISTING) - #430

Open
Affan Dar (affandar) wants to merge 1 commit into
mainfrom
affan/foundry-existing-account
Open

Affan Dar (affandar) wants to merge 1 commit into
mainfrom
affan/foundry-existing-account

Conversation

@affandar

Copy link
Copy Markdown
Contributor

Problem

The deploy step of the last four Create release runs failed (0.8.18 to 0.8.21). Each release was published. The test environment was not upgraded.

What happened in each run:
1. The deploy sends the whole base-infra template, with the Foundry account in it
2. An Azure Policy on the subscription refuses a Cognitive Services account that allows key sign-in
3. base-infra fails. Nothing after it runs: no image push, no rollout

The account had not changed. The deploy sent it again anyway, and that is what the policy refuses.

FOUNDRY_AUTH_MODE=entra turns key sign-in off, but it cannot be used here yet. The HorizonDB embedding loop sends the account key on every call (df.http with the api-key header). The live embedding tests of the release gate read the same key. Related: #13, #408.

Change

A new stamp setting, FOUNDRY_ACCOUNT_EXISTING (default false).

FOUNDRY_ACCOUNT_EXISTING=false (default, same as before)
1. base-infra creates or updates the account
2. base-infra creates the model deployments, the key secret, the role

FOUNDRY_ACCOUNT_EXISTING=true
1. base-infra does not send the account at all
2. base-infra creates the model deployments, the key secret, the role
  • foundry-account.bicep (new) holds the account. main.bicep skips it when the switch is on.
  • foundry.bicep reads the account as an existing resource in both cases.
  • The deploy workflows pass the switch from a variable of the azure-deploy environment, like AKS_ENTRA_ID_AUTH.
  • The switch can be turned off again.

Two small additions:

  • The deploy Action's one-line diagnostic now says whether the policy refused the Foundry account or the AKS cluster. Before, it always pointed at AKS. It still prints no resource or policy name.
  • DEPLOY_PRINCIPAL_TYPE=User: a person can give their own object ID in DEPLOY_PRINCIPAL_ID when the Azure CLI cannot look it up. Before, the ID was always read as a service principal.

This does not make the account compliant with such a policy. It stops the deploy from failing on an account it did not change. The real end state is keyless embedding calls, then FOUNDRY_AUTH_MODE=entra.

Checks

az deployment group validate against a stamp where the policy is active (read-only):

Template Result
foundry.bicep from main Refused by the policy
New foundry.bicep (account as existing) Accepted
New foundry-account.bicep Refused, as expected. It is skipped when the switch is on
Whole main.bicep, switch on Accepted
Whole main.bicep, switch off Refused

A real base-infra deploy with the switch on then succeeded on that stamp. The account was not updated. All other parameters were the same as in the last deploy by the workflow.

Tests: 448 deploy-script tests, 135 CI script tests, privacy check 0 findings, az bicep build on the three files.

After merge

Set the variable FOUNDRY_ACCOUNT_EXISTING=true on the azure-deploy environment. Without it the next release deploy fails in the same place.

…UNT_EXISTING)

Every base-infra deploy sent the Foundry account's full definition. A
subscription policy can refuse an account that allows key sign-in. The
deploy then fails at base-infra, also when nothing about the account
changed. Turning key sign-in off is not an option while the HorizonDB
embedding loop sends the account key on every call.

FOUNDRY_ACCOUNT_EXISTING=true makes the stamp leave the account as it is:

- The account's definition moves from foundry.bicep to the new
  foundry-account.bicep. main.bicep skips that file when the switch is on.
- foundry.bicep reads the account as an existing resource and still
  manages the model deployments, the azure-oai-key secret and the
  data-plane role.
- The default (false) sends the same account as before.
- The deploy workflows read the switch from a variable of the
  azure-deploy environment.

Also:

- The deploy Action's one-line diagnostic says whether Azure Policy
  refused the Foundry account or the AKS cluster. It still prints no
  resource or policy name.
- DEPLOY_PRINCIPAL_TYPE=User lets a person give their own object ID in
  DEPLOY_PRINCIPAL_ID when the Azure CLI cannot look it up.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant