Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build and deploy AI applications on Azure AI Foundry using Microsoft's model catalog and AI services
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
resource/create/references/workflows.md
1# Detailed Workflows: Create Foundry Resource23**Table of Contents:** [Workflow 1: Create Resource Group](#workflow-1-create-resource-group---detailed-steps) · [Workflow 2: Create Foundry Resource](#workflow-2-create-foundry-resource---detailed-steps) · [Workflow 3: Register Resource Provider](#workflow-3-register-resource-provider---detailed-steps)45## Workflow 1: Create Resource Group - Detailed Steps67### Step 1: Ask user preference89Ask the user which option they prefer:101. Use an existing resource group112. Create a new resource group1213### Step 2a: If user chooses "Use existing resource group"1415Count and list existing resource groups:1617```bash18# Count total resource groups19TOTAL_RG_COUNT=$(az group list --query "length([])" -o tsv)2021# Get list of resource groups (up to 5 most recent)22az group list --query "[-5:].{Name:name, Location:location}" --out table23```2425**Handle based on count:**2627**If 0 resources found:**28- Inform user: "No existing resource groups found"29- Ask if they want to create a new one, then proceed to Step 2b3031**If 1-4 resources found:**32- Display all X resource groups to the user33- Let user select from the list34- Fetch the selected resource group details:35```bash36az group show --name <selected-rg-name> --query "{Name:name, Location:location, State:properties.provisioningState}"37```38- Display details to user, then proceed to create Foundry resource3940**If 5+ resources found:**41- Display the 5 most recent resource groups42- Present options:431. Select from the 5 displayed442. Other (see all resource groups)45- If user selects a resource group, fetch details:46```bash47az group show --name <selected-rg-name> --query "{Name:name, Location:location, State:properties.provisioningState}"48```49- If user chooses "Other", show all:50```bash51az group list --query "[].{Name:name, Location:location}" --out table52```53Then let user select, and fetch details as above54- Display details to user, then proceed to create Foundry resource5556### Step 2b: If user chooses "Create new resource group"57581. List available Azure regions:5960```bash61az account list-locations --query "[].{Region:name}" --out table62```6364Common regions:65- `eastus`, `eastus2` - US East Coast66- `westus`, `westus2`, `westus3` - US West Coast67- `centralus` - US Central68- `westeurope`, `northeurope` - Europe69- `southeastasia`, `eastasia` - Asia Pacific70712. Ask user to choose a region from the list above72733. Create resource group in the chosen region:7475```bash76az group create \77--name <resource-group-name> \78--location <user-chosen-location>79```80814. Verify creation:8283```bash84az group show --name <resource-group-name> --query "{Name:name, Location:location, State:properties.provisioningState}"85```8687Expected output: `State: "Succeeded"`8889## Workflow 2: Create Foundry Resource - Detailed Steps9091### Step 1: Verify prerequisites9293```bash94# Check Azure CLI version (need 2.0+)95az --version9697# Verify authentication98az account show99100# Check resource provider registration status101az provider show --namespace Microsoft.CognitiveServices --query "registrationState"102```103104If provider not registered, see Workflow #3: Register Resource Provider.105106### Step 2: Choose location107108**Always ask the user to choose a location.** List available regions and let the user select:109110```bash111# List available regions for Cognitive Services112az account list-locations --query "[].{Region:name, DisplayName:displayName}" --out table113```114115Common regions for AI Services:116- `eastus`, `eastus2` - US East Coast117- `westus`, `westus2`, `westus3` - US West Coast118- `centralus` - US Central119- `westeurope`, `northeurope` - Europe120- `southeastasia`, `eastasia` - Asia Pacific121122> **Important:** Do not automatically use the resource group's location. Always ask the user which region they prefer.123124### Step 3: Create Foundry resource125126```bash127az cognitiveservices account create \128--name <resource-name> \129--resource-group <rg> \130--kind AIServices \131--sku S0 \132--location <location> \133--yes134```135136**Parameters:**137- `--name`: Unique resource name (globally unique across Azure)138- `--resource-group`: Existing resource group name139- `--kind`: **Must be `AIServices`** for multi-service resource140- `--sku`: Must be **S0** (Standard - the only supported tier for AIServices)141- `--location`: Azure region (**always ask user to choose** from available regions)142- `--yes`: Auto-accept terms without prompting143144### Step 4: Verify resource creation145146```bash147# Check resource details to verify creation148az cognitiveservices account show \149--name <resource-name> \150--resource-group <rg>151152# View endpoint and configuration153az cognitiveservices account show \154--name <resource-name> \155--resource-group <rg> \156--query "{Name:name, Endpoint:properties.endpoint, Location:location, Kind:kind, SKU:sku.name}"157```158159Expected output:160- `provisioningState: "Succeeded"`161- Endpoint URL162- SKU: S0163- Kind: AIServices164165### Step 5: Get access keys166167```bash168az cognitiveservices account keys list \169--name <resource-name> \170--resource-group <rg>171```172173This returns `key1` and `key2` for API authentication.174175## Workflow 3: Register Resource Provider - Detailed Steps176177### When Needed178179Required when:180- First time creating Cognitive Services in subscription181- Error: `ResourceProviderNotRegistered`182- Insufficient permissions during resource creation183184### Steps185186**Step 1: Check registration status**187188```bash189az provider show \190--namespace Microsoft.CognitiveServices \191--query "registrationState"192```193194Possible states:195- `Registered`: Ready to use196- `NotRegistered`: Needs registration197- `Registering`: Registration in progress198199**Step 2: Register provider**200201```bash202az provider register --namespace Microsoft.CognitiveServices203```204205**Step 3: Wait for registration**206207Registration typically takes 1-2 minutes. Check status:208209```bash210az provider show \211--namespace Microsoft.CognitiveServices \212--query "registrationState"213```214215Wait until state is `Registered`.216217**Step 4: Verify registration**218219```bash220az provider list --query "[?namespace=='Microsoft.CognitiveServices']"221```222223### Required Permissions224225To register a resource provider, you need one of:226- **Subscription Owner** role227- **Contributor** role228- **Custom role** with `Microsoft.*/register/action` permission229230**If you are not the subscription owner:**2311. Ask someone with the **Owner** or **Contributor** role to register the provider for you2322. Alternatively, ask them to grant you the `/register/action` privilege so you can register it yourself233234**Alternative registration methods:**235- **Azure CLI** (recommended): `az provider register --namespace Microsoft.CognitiveServices`236- **Azure Portal**: Navigate to Subscriptions → Resource providers → Microsoft.CognitiveServices → Register237- **PowerShell**: `Register-AzResourceProvider -ProviderNamespace Microsoft.CognitiveServices`238