Starting…

No run yet. Write your code, then click Run.

Lesson

Provisioning without tears

Already checking TPM quota by region before deploying? Skip to the next lesson.

You can create everything correctly and still be unable to run a single request. This lesson is about the setup problems that look like broken code.

The 0 TPM wall

Quota is how much you are allowed to use. For AI models it is measured in TPM, tokens per minute.

A brand new resource can arrive with a quota of zero. Not a small number. Zero. The resource exists, your code is fine, and nothing will ever run until someone grants you capacity. The slider in the portal will not move.

Quota is counted per subscription, per region, per model. Having plenty in one region tells you nothing about another.

  • Region is which datacentre. Quota does not travel with you.
  • Hub versus project: agents run on a project. A hub on its own is not enough, which is a common half-finished setup.

Doing it the repeatable way

Clicking through a portal works once and then nobody can remember what they did. The alternative is infrastructure as code: your setup written in a file, so it can be reviewed, repeated and deleted cleanly.

azd up is the Azure command that reads that file and builds everything. Bicep is the language the file is written in.

What to write

Keep Modules 6 and 7 correct, then fix:

  1. AZURE_QUOTA_TPM to something positive, say 30, instead of 0
  2. AZURE_REGION to eastus2 or swedencentral
  3. AZURE_FOUNDRY_KIND to project
  4. AZD_READY to True, standing in for a successful azd up

The real template

This lab uses recorded answers, but the template it stands for is in this repository, in azure.yaml and infra/. Open infra/resources.bicep beside this lesson. Every trap above is a named setting you can read:

  • modelCapacity is the 0 TPM wall, as a number you set deliberately
  • deploymentName is separate from the model name, which is Module 6's trap
  • a project resource, which is the hub versus project problem
  • disableLocalAuth: true, which is Module 7's no-keys rule enforced at setup

If you do have an Azure account:

azd auth login && azd env new azure-ai-agent && azd up

Then delete it again. Nothing later in the course needs it running.

The point

Quota is per subscription, per region, per model, and it can start at zero.

Break it on purpose

Leave AZURE_QUOTA_TPM at 0 and run. Read the error. If you ever see that for real, ask for quota before you touch your code.

Check yourself

Answer out loud first. Reading the answer without trying is where the learning leaks out.

  1. 1. Why can a brand-new resource refuse every deployment?

  2. 2. Does changing region reset your quota problem?

  3. 3. What does azd up buy you versus clicking the portal?