### Local Development Setup Source: https://github.com/microsoft/azure-skills/blob/main/landing-page/README.md Navigate to the landing-page directory, install dependencies, and start the local development server. ```bash cd landing-page npm ci npm run dev ``` -------------------------------- ### Install and Verify EF Core Tools Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-deploy/references/recipes/azd/ef-migrations.md Install the EF Core tools globally and verify the installation by checking the version. ```bash dotnet tool install --global dotnet-ef dotnet ef --version # Verify installation ``` -------------------------------- ### Quick Start with Autoconfigure Source: https://github.com/microsoft/azure-skills/blob/main/skills/appinsights-instrumentation/references/sdk/azure-monitor-opentelemetry-exporter-java.md This snippet indicates that autoconfigure is the preferred method for starting with OpenTelemetry. Use the `azure-monitor-opentelemetry-autoconfigure` artifact. ```java // Prefer autoconfigure instead: // azure-monitor-opentelemetry-autoconfigure ``` -------------------------------- ### Install Azure Identity SDK Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-deploy/references/sdk/azure-identity-py.md Install the azure-identity package using pip. ```bash pip install azure-identity ``` -------------------------------- ### Install Azure Document Intelligence .NET SDK Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-ai/references/sdk/azure-ai-document-intelligence-dotnet.md Use the `dotnet add package` command to install the Azure.AI.DocumentIntelligence NuGet package. ```bash dotnet add package Azure.AI.DocumentIntelligence ``` -------------------------------- ### Install and Login to Azure CLI Source: https://github.com/microsoft/azure-skills/blob/main/skills/entra-app-registration/references/cli-commands.md Ensure Azure CLI is installed and log in to your Azure account. Optionally, set a default subscription. ```bash az version ``` ```bash az login ``` ```bash az account set --subscription "Your Subscription Name" ``` -------------------------------- ### Install Azure Developer CLI Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-deploy/references/sdk/azd-deployment.md Use this command to install the Azure Developer CLI on your system. ```bash curl -fsSL https://aka.ms/install-azd.sh | bash ``` -------------------------------- ### Install Azure Identity Package Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-deploy/references/sdk/azure-identity-dotnet.md Use the `dotnet add package` command to install the Azure.Identity NuGet package. ```bash dotnet add package Azure.Identity ``` -------------------------------- ### Build and Preview Source: https://github.com/microsoft/azure-skills/blob/main/landing-page/README.md Build the project for production and start a local server to preview the built output. ```bash cd landing-page npm run build npm run preview ``` -------------------------------- ### Verify Terraform Installation Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-validate/references/recipes/terraform/README.md Check if Terraform is installed on the system. If not, refer to the official installation guide. ```bash terraform version ``` -------------------------------- ### Installing Context7 MCP Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-prepare/references/recipes/azd/terraform.md Command to install the Context7 MCP if it's not available, which might be required for certain AVM Terraform module examples or guidance. ```bash npx @upstash/context7-mcp@latest ``` -------------------------------- ### Terraform VM Deployment Quickstart Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-compute/workflows/vm-creator/examples/terraform/README.md Initialize, plan, and apply Terraform configurations to deploy a Linux VM. Ensure prerequisites like Terraform, Azure CLI login, and SSH keys are set up. ```bash MY_IP=$(curl -s ifconfig.me)/32 # your current public IP, locked to /32 terraform init terraform plan -var "vm_name=dev-vm" -var "admin_public_key=$(cat ~/.ssh/id_rsa.pub)" -var "subscription_id=$AZ_SUB" -var "resource_group_name=dev-vm-rg" -var "ssh_source_address_prefix=$MY_IP" terraform apply -var "vm_name=dev-vm" -var "admin_public_key=$(cat ~/.ssh/id_rsa.pub)" -var "subscription_id=$AZ_SUB" -var "resource_group_name=dev-vm-rg" -var "ssh_source_address_prefix=$MY_IP" ``` -------------------------------- ### Quick Setup for Foundry Resource Source: https://github.com/microsoft/azure-skills/blob/main/skills/microsoft-foundry/resource/create/references/patterns.md This pattern completes the setup of a Foundry resource in a single operation. It handles resource group creation or selection and then deploys the resource. Use this for straightforward deployments. ```bash # Ask user: "Use existing resource group or create new?" # ==== If user chooses "Use existing" ==== # Count and list existing resource groups TOTAL_RG_COUNT=$(az group list --query "length([])" -o tsv) az group list --query "[-5:].{Name:name, Location:location}" --out table # Based on count: show appropriate list and options # User selects resource group RG="" # Fetch details to verify az group show --name $RG --query "{Name:name, Location:location, State:properties.provisioningState}" # Then skip to creating Foundry resource below # ==== If user chooses "Create new" ==== # List regions and ask user to choose az account list-locations --query "[].{Region:name}" --out table # Variables RG="rg-ai-services" # New resource group name LOCATION="westus2" # User's chosen location RESOURCE_NAME="my-foundry-resource" # Create new resource group az group create --name $RG --location $LOCATION # Verify creation az group show --name $RG --query "{Name:name, Location:location, State:properties.provisioningState}" # Create Foundry resource in user's chosen location az cognitiveservices account create \ --name $RESOURCE_NAME \ --resource-group $RG \ --kind AIServices \ --sku S0 \ --location $LOCATION \ --yes # Get endpoint and keys echo "Resource created successfully!" az cognitiveservices account show \ --name $RESOURCE_NAME \ --resource-group $RG \ --query "{Endpoint:properties.endpoint, Location:location}" az cognitiveservices account keys list \ --name $RESOURCE_NAME \ --resource-group $RG ``` -------------------------------- ### Start Local Emulator Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-prepare/references/services/durable-task-scheduler/README.md Use this command to start the Durable Task Scheduler emulator locally for development and testing. Ensure you have Docker installed and running. ```bash # Start the emulator (see https://mcr.microsoft.com/v2/dts/dts-emulator/tags/list for available versions) docker pull mcr.microsoft.com/dts/dts-emulator:latest docker run -d -p 8080:8080 -p 8082:8082 --name dts-emulator mcr.microsoft.com/dts/dts-emulator:latest # Dashboard available at http://localhost:8082 ``` -------------------------------- ### OnTokenIssuanceStart Function Example Source: https://github.com/microsoft/azure-skills/blob/main/skills/entra-app-registration/references/sdk/microsoft-azure-webjobs-extensions-authentication-events-dotnet.md This example demonstrates how to create an Azure Function that triggers on a token issuance start event, processes the request, and provides custom claims for the token. ```APIDOC ## OnTokenIssuanceStart ### Description This function is triggered by a `WebJobsAuthenticationEventsTrigger` when a token issuance event starts. It processes the incoming `WebJobsTokenIssuanceStartRequest` and returns a `WebJobsTokenIssuanceStartResponse` that can include actions like providing custom claims. ### Method `Run` ### Parameters - `request` (WebJobsTokenIssuanceStartRequest) - The incoming request object containing details about the token issuance event. - `log` (ILogger) - The logger instance for writing logs. ### Request Example (Not directly shown, but the `request` parameter is of type `WebJobsTokenIssuanceStartRequest`) ### Response #### Success Response - `WebJobsAuthenticationEventResponse` - An object that contains a list of actions to be performed. In this example, it includes providing custom claims. #### Response Example ```csharp { "Actions": [ { "Claims": { "claim": "value" } } ] } ``` ``` -------------------------------- ### Agent Initialization and Sample Commands Source: https://github.com/microsoft/azure-skills/blob/main/skills/microsoft-foundry/foundry-agent/create/references/azd-ai-cli.md Commands for listing available AI agent samples and initializing a new project from a manifest URL or existing source code. ```bash azd ai agent sample list # curated catalog -- pick a manifestUrl azd ai agent init -m # scaffold from a sample azd ai agent init --src # scaffold from existing source ``` -------------------------------- ### Usage Example: Get Cached Data Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-prepare/references/services/app-service/templates/recipes/redis/source/python.md This example demonstrates how to retrieve data from the cache using the `get_cache()` function. If the data is not found, it computes a value, stores it in the cache with a 5-minute TTL, and then returns it. ```python from cache import get_cache def get_cached(key: str): cache = get_cache() value = cache.get(key) if value is None: value = "computed-value" cache.setex(key, 300, value) # TTL 5 minutes return value ``` -------------------------------- ### Initialize Hosted Agent Source: https://github.com/microsoft/azure-skills/blob/main/skills/microsoft-foundry/foundry-agent/create/quick-start-hosted.md Use this command to scaffold a new agent project. Ensure you replace placeholders like '' and '' with your specific values. The `--runtime` and `--entry-point` flags are critical for correct project setup. ```bash azd ai agent init --no-prompt \ -m "" \ --deploy-mode code \ --runtime python_3_13 \ --entry-point main.py \ --agent-name ``` -------------------------------- ### Bash Deployment Command Example Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-compute/workflows/vm-creator/references/delivery-options/save-local.md Example of the bash command to deploy resources using Bicep templates. Ensure you are in the correct directory and have the necessary parameters defined. ```bash cd ~/source/my-infra/infra/dev-vm az deployment group create --resource-group dev-vm-rg --template-file main.bicep \ --parameters vmName=dev-vm adminUsername=azureuser \ adminPublicKey="$(cat ~/.ssh/id_rsa.pub)" ``` -------------------------------- ### Minimal Durable Functions Orchestration Example Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-prepare/references/services/durable-task-scheduler/dotnet.md This C# example demonstrates a minimal Durable Functions application. It includes an HTTP-triggered function to start an orchestration and a simple orchestration that calls an activity function. ```csharp using Microsoft.Azure.Functions.Worker; using Microsoft.DurableTask; using Microsoft.DurableTask.Client; public static class DurableFunctionsApp { [Function("HttpStart")] public static async Task HttpStart( [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req, [DurableClient] DurableTaskClient client) { string instanceId = await client.ScheduleNewOrchestrationInstanceAsync(nameof(MyOrchestration)); return await client.CreateCheckStatusResponseAsync(req, instanceId); } [Function(nameof(MyOrchestration))] public static async Task MyOrchestration([OrchestrationTrigger] TaskOrchestrationContext context) { var result1 = await context.CallActivityAsync(nameof(SayHello), "Tokyo"); var result2 = await context.CallActivityAsync(nameof(SayHello), "Seattle"); return $"{result1}, {result2}"; } [Function(nameof(SayHello))] public static string SayHello([ActivityTrigger] string name) => $"Hello {name}!"; } ``` -------------------------------- ### Start Azure AI Agent Locally Source: https://github.com/microsoft/azure-skills/blob/main/skills/microsoft-foundry/foundry-agent/create/references/local-run.md Run the Azure AI agent locally after activating the service directory's virtual environment. This command handles dependency installation and starts the agent server. ```bash azd ai agent run ``` -------------------------------- ### Provision Azure resources for the first time Source: https://github.com/microsoft/azure-skills/blob/main/skills/python-appservice-deploy/references/deploy-azd.md Create a new Azure environment and set the location and optional App Service SKU. This is a one-time setup before the initial deployment. ```bash azd env new azd env set AZURE_LOCATION # Optional: override default SKU via the template's parameters azd env set APP_SERVICE_SKU P0v3 ``` -------------------------------- ### Minimal Durable Functions App Example Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-prepare/references/services/durable-task-scheduler/java.md A basic Java example demonstrating how to start an orchestration from an HTTP trigger, call an activity function, and return status information. Imports are crucial for Durable Functions. ```java import com.microsoft.azure.functions.*; import com.microsoft.azure.functions.annotation.*; import com.microsoft.durabletask.*; import com.microsoft.durabletask.azurefunctions.*; public class DurableFunctionsApp { @FunctionName("HttpStart") public HttpResponseMessage httpStart( @HttpTrigger(name = "req", methods = {HttpMethod.POST}, authLevel = AuthorizationLevel.FUNCTION) HttpRequestMessage request, @DurableClientInput(name = "durableContext") DurableClientContext durableContext) { DurableTaskClient client = durableContext.getClient(); String instanceId = client.scheduleNewOrchestrationInstance("MyOrchestration"); return durableContext.createCheckStatusResponse(request, instanceId); } @FunctionName("MyOrchestration") public String myOrchestration( @DurableOrchestrationTrigger(name = "ctx") TaskOrchestrationContext ctx) { String result1 = ctx.callActivity("SayHello", "Tokyo", String.class).await(); String result2 = ctx.callActivity("SayHello", "Seattle", String.class).await(); return result1 + ", " + result2; } @FunctionName("SayHello") public String sayHello(@DurableActivityTrigger(name = "name") String name) { return "Hello " + name + "!"; } } ``` -------------------------------- ### Upgrade Workflow Example Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-upgrade/references/languages/java/README.md Illustrates the high-level workflow for upgrading legacy Azure SDKs, showing the sequence of precheck, plan, execute, and validate phases. ```text "upgrade legacy azure sdk" → precheck → plan → execute → validate ``` -------------------------------- ### HTTP Trigger Example for Azure Functions v4 Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-cloud-migrate/references/services/functions/runtimes/javascript.md An example of an HTTP trigger function using the v4 programming model. It handles GET and POST requests and retrieves a name from query parameters or the request body. ```javascript app.http('httpFunction', { methods: ['GET', 'POST'], authLevel: 'anonymous', handler: async (request, context) => { const name = request.query.get('name') || (await request.text()); return { body: `Hello, ${name}!` }; } }); ``` -------------------------------- ### HTTP Trigger Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-cloud-migrate/references/services/functions/runtimes/java.md Example of an HTTP trigger for a Java Azure Function. It handles GET and POST requests and can access query parameters. ```APIDOC ## HTTP Trigger ### Description Handles HTTP requests with GET and POST methods. Accesses query parameters to personalize the response. ### Method GET, POST ### Endpoint Dynamic based on function app configuration ### Parameters #### Path Parameters None #### Query Parameters - **name** (string) - Optional - The name to be greeted. #### Request Body Optional string payload for POST requests. ### Request Example ```json { "example": "POST request body or GET query parameter" } ``` ### Response #### Success Response (200) - **body** (string) - A greeting message. #### Response Example ```json { "example": "Hello, [name]" } ``` ``` -------------------------------- ### Example: Unknown Framework Detection Output Source: https://github.com/microsoft/azure-skills/blob/main/skills/python-appservice-deploy/references/detect.md This output is displayed when no supported framework is auto-detected, reminding the user to set a startup command manually. ```text Detected: Python project, framework unknown. The app will deploy, but App Service may not start it correctly until you set a startup command: az webapp config set -n -g --startup-file '' See startup-commands.md for examples. ``` -------------------------------- ### Durable Functions Setup - Requirements Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-prepare/references/services/durable-task-scheduler/python.md Install the necessary Azure Functions and Durable Functions packages for Python. Finding the latest versions is recommended. ```txt azure-functions azure-functions-durable azure-identity ``` -------------------------------- ### Quick Start with Azure Developer CLI Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-deploy/references/sdk/azd-deployment.md A common workflow for initializing, authenticating, and deploying an application using the Azure Developer CLI. ```bash azd auth login azd init azd up # provision + build + deploy ``` -------------------------------- ### Handle Token Issuance Start Event in .NET Source: https://github.com/microsoft/azure-skills/blob/main/skills/entra-app-registration/references/sdk/microsoft-azure-webjobs-extensions-authentication-events-dotnet.md This C# function demonstrates how to handle a token issuance start event using the Azure Functions Authentication Events SDK. It adds a custom claim to the token response. Ensure the Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents package is installed. ```csharp using Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents; using Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents.TokenIssuanceStart; [FunctionName("OnTokenIssuanceStart")] public static WebJobsAuthenticationEventResponse Run( [WebJobsAuthenticationEventsTrigger] WebJobsTokenIssuanceStartRequest request, ILogger log) { var response = new WebJobsTokenIssuanceStartResponse(); response.Actions.Add(new WebJobsProvideClaimsForToken { Claims = new Dictionary { { "claim", "value" } } }); return response; } ``` -------------------------------- ### Initialize Project with Base Template Source: https://github.com/microsoft/azure-skills/blob/main/skills/azure-prepare/references/services/app-service/templates/recipes/README.md Use this command to initialize a new project with a base template. Replace `