Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Validate Azure configurations, ARM/Bicep templates, and resource settings before deployment
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/recipes/azd/environment.md
1# AZD Environment Setup23> **⛔ MANDATORY**: You MUST set up an AZD environment before running any deployment commands.45## Step 1: Check Existing Environments67```bash8azd env list9```1011**If an environment is already selected** (marked with `*`), check its current values:1213```bash14azd env get-values15```1617If `AZURE_ENV_NAME`, `AZURE_SUBSCRIPTION_ID`, and `AZURE_LOCATION` are already set, confirm with user:1819```20Question: "An AZD environment is already configured. Would you like to use it?"2122Environment: {env-name}23Subscription: {subscription-id}24Location: {location}2526Choices: [27"Yes, use this environment (Recommended)",28"No, create a new environment"29]30```3132If user confirms → skip to **Verify Configuration**. Otherwise → continue to Step 2.3334**If NO environment exists or none is selected:**35- Continue to Step 23637---3839## Step 2: Create New Environment4041> **⛔ DO NOT use generic names like "dev", "prod", or "test"**42>43> These cause naming conflicts in Azure resource groups and resources. Always generate a unique name.4445### Generate Suggested Name4647Use this pattern:48```49{project-name}-{random-4-chars}50```5152**Examples:**53- `dadjokes-x7k2`54- `todoapp-m3p9`55- `myapi-q5w8`5657### Prompt User5859**You MUST use `ask_user` to confirm the environment name:**6061```62I need to create an AZD environment for this deployment.6364Suggested name: {project-name}-{random-4-chars}6566Would you like to use this name or enter a custom one?67```6869### Create Environment7071After user confirms:72```bash73azd env new <environment-name> --no-prompt74```7576---7778## Step 3: Configure Environment7980Set subscription and location:8182```bash83azd env set AZURE_SUBSCRIPTION_ID <subscription-id>84azd env set AZURE_LOCATION <location>85```8687---8889## Verify Configuration9091```bash92azd env get-values93```9495Confirm these values are set:96- `AZURE_ENV_NAME`97- `AZURE_SUBSCRIPTION_ID`98- `AZURE_LOCATION`99100---101102## Only Then Proceed103104After environment is configured, proceed with `azd up --no-prompt`.105