### Install, Build, and Start Node.js Application Source: https://learn.microsoft.com/en-us/azure/app-service/tutorial-ai-agent-web-app-langgraph-foundry-node Installs project dependencies, builds the application, and starts the local development server. This is the initial setup step for running the sample application. ```Bash npm install npm run build npm start ``` -------------------------------- ### Install Dependencies and Start Server Source: https://learn.microsoft.com/en-us/azure/documentdb/tutorial-nodejs-web-app Navigates to the server directory, installs Node.js dependencies using npm, and starts the application server. ```bash cd server npm install npm start ``` -------------------------------- ### Install and Start the Application Source: https://learn.microsoft.com/en-us/azure/active-directory-b2c/quickstart-single-page-app Install dependencies, update packages, and start the Node.js server for the single-page application. ```bash npm install npm update npm start ``` -------------------------------- ### Build and Start Server Locally Source: https://learn.microsoft.com/en-us/azure/azure-functions/functions-mcp-tutorial Install dependencies, build the project, and start the server locally using 'npm install', 'npm run build', and 'func start'. Ensure the local storage emulator is running. ```shell npm install npm run build func start ``` -------------------------------- ### Get Dictionary Examples in C# Source: https://learn.microsoft.com/en-us/azure/ai-services/translator/translator-text-apis Use this snippet to get contextual examples for a given source term and its translation. Ensure you have the Newtonsoft.Json NuGet package installed. ```csharp using System; using Newtonsoft.Json; // Install Newtonsoft.Json with NuGet class Program { private static readonly string key = ""; private static readonly string endpoint = "https://api.cognitive.microsofttranslator.com"; // location, also known as region. // required if you're using a multi-service or regional (not global) resource. It can be found in the Azure portal on the Keys and Endpoint page. private static readonly string location = ""; static async Task Main(string[] args) { // See examples of terms in context string route = "/dictionary/examples?api-version=3.0&from=en&to=es"; object[] body = new object[] { new { Text = "sunlight", Translation = "luz solar" } } ; var requestBody = JsonConvert.SerializeObject(body); using (var client = new HttpClient()) using (var request = new HttpRequestMessage()) { // Build the request. request.Method = HttpMethod.Post; request.RequestUri = new Uri(endpoint + route); request.Content = new StringContent(requestBody, Encoding.UTF8, "application/json"); request.Headers.Add("Ocp-Apim-Subscription-Key", key); // location required if you're using a multi-service or regional (not global) resource. request.Headers.Add("Ocp-Apim-Subscription-Region", location); // Send the request and get response. HttpResponseMessage response = await client.SendAsync(request).ConfigureAwait(false); // Read response as a string. string result = await response.Content.ReadAsStringAsync(); Console.WriteLine(result); } } } ``` -------------------------------- ### Run Go Quickstart Sample Source: https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/dall-e Use this command to compile and run the Go quickstart program. Ensure you have set the necessary environment variables (e.g., AZURE_OPENAI_ENDPOINT). ```shell go run quickstart.go ``` -------------------------------- ### Configure Start Task for MS-MPI Installation Source: https://learn.microsoft.com/en-us/azure/batch/batch-mpi This snippet shows how to add a start task to a Batch pool definition to install MS-MPI. The start task downloads the MS-MPI setup package and executes an unattended installation. It requires administrative privileges and is configured to wait for successful completion. ```C# // Add a start task to the pool which we use for installing MS-MPI on // the nodes as they join the pool (or when they are restarted). poolData.StartTask = new BatchAccountPoolStartTask() { CommandLine = "cmd /c MSMpiSetup.exe -unattend -force", UserIdentity = new BatchUserIdentity() { AutoUser = new BatchAutoUserSpecification() { ElevationLevel = BatchUserAccountElevationLevel.Admin } }, WaitForSuccess = true, }; poolData.StartTask.ResourceFiles.Add(new BatchResourceFile() { HttpUri = new Uri("https://mystorageaccount.blob.core.windows.net/mycontainer/MSMpiSetup.exe"), FilePath = "MSMpiSetup.exe" }); // Create the fully configured pool. ArmOperation pool = await poolCollection.CreateOrUpdateAsync( WaitUntil.Completed, "MultiInstanceSamplePool", poolData); ``` -------------------------------- ### Scaffold a Go quickstart sample app Source: https://learn.microsoft.com/en-us/azure/azure-functions/functions-cli-develop-local Use `func quickstart` with `--stack go` and `--resource http` to browse and scaffold complete sample apps, such as HTTP APIs. ```bash func quickstart --stack go --resource http ``` -------------------------------- ### Example: Get Content for a Specific Wiki Page Source: https://learn.microsoft.com/en-us/azure/devops/project/wiki/wiki-create-repo This example shows how to fetch the content for the 'Get Started' page within the 'MyProjectwiki' wiki. Note that the `--content "Hello World"` parameter in the example seems to be a placeholder and might not function as intended for retrieving existing content. ```Azure CLI az devops wiki page show --path 'Get Started' --wiki 'MyProjectwiki' --content "Hello World" ``` -------------------------------- ### Full Quickstart Example with API Key Source: https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/dall-e This is a complete Go program demonstrating image generation using Azure OpenAI with API key authentication. It sets up the client, makes an image generation request, and prints the URL of the generated image. Ensure AZURE_OPENAI_ENDPOINT and AZURE_OPENAI_API_KEY are set. ```Go package main import ( "context" "fmt" "net/http" "os" "log" "github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" ) func main() { azureOpenAIEndpoint := os.Getenv("AZURE_OPENAI_ENDPOINT") modelDeploymentID := "gpt-image-1" azureOpenAIKey := os.Getenv("AZURE_OPENAI_API_KEY") credential := azcore.NewKeyCredential(azureOpenAIKey) client, err := azopenai.NewClientWithKeyCredential( azureOpenAIEndpoint, credential, nil) if err != nil { log.Printf("ERROR: %s", err) return } sp, err := client.GetImageGenerations(context.TODO(), azopenai.ImageGenerationOptions{ Prompt: to.Ptr("A painting of a cat in the style of Dali."), ResponseFormat: to.Ptr(azopenai.ImageGenerationResponseFormatURL), DeploymentName: to.Ptr(modelDeploymentID), }, nil) if err != nil { // Implement application specific error handling logic. log.Printf("ERROR: %s", err) return } for _, generatedImage := range resp.Data { // The underlying type for the generatedImage is determined by the value of // ImageGenerationOptions.ResponseFormat. // In this example we use `azopenai.ImageGenerationResponseFormatURL`, // so the underlying type will be ImageLocation. sp, err := http.Head(*generatedImage.URL) if err != nil { // Implement application specific error handling logic. log.Printf("ERROR: %s", err) return } fmt.Fprintf(os.Stderr, "Image generated, HEAD request on URL returned %d\nImage URL: %s\n", resp.StatusCode, *generatedImage.URL) } } ``` -------------------------------- ### Get Project GUID using Azure CLI Source: https://learn.microsoft.com/en-us/azure/foundry/agents/how-to/tools/toolbox Retrieves the project GUID required for uploading files to the Code Interpreter. Ensure you have the Azure CLI installed and are logged in. ```Bash ARM_TOKEN=$(az account get-access-token --query accessToken -o tsv) PROJECT_GUID=$(curl -s -H "Authorization: Bearer $ARM_TOKEN" \ "https://management.azure.com/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.CognitiveServices/accounts/{account}/projects/{project}?api-version=2025-06-01" \ | jq -r '.properties.amlWorkspace.internalId') ``` -------------------------------- ### Example: Get details for a specific Grid2dRepresentation Source: https://learn.microsoft.com/en-us/azure/energy-data-services/tutorial-reservoir-ddms-apis This example shows how to retrieve detailed metadata for a Grid2dRepresentation resource using its GUID. It includes a sample request URL and headers. ```Bash curl --request GET \ --url https://admetest.energy.azure.com/api/reservoir-ddms/v2/dataspaces/demo%2FVolve/resources/resqml20.obj_Grid2dRepresentation/07cb9ebb-299f-469b-9792-e76633a72b89 \ --header 'Authorization: Bearer ey.....' \ --header 'data-partition-id: dp1' ``` -------------------------------- ### Install Data API Builder CLI Source: https://learn.microsoft.com/en-us/azure/data-api-builder/get-started/get-started-with-data-api-builder Installs the latest version of the Microsoft.DataApiBuilder package globally as a .NET tool. Use this command to get started with DAB. ```.NET CLI dotnet tool install --global Microsoft.DataApiBuilder ``` -------------------------------- ### Scaffold a .NET quickstart sample app Source: https://learn.microsoft.com/en-us/azure/azure-functions/functions-cli-develop-local Use `func quickstart` with `--stack dotnet` and `--resource http` to browse and scaffold complete sample apps, such as HTTP APIs. ```bash func quickstart --stack dotnet --resource http ``` -------------------------------- ### Clone Sample Project Source: https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/configure-spring-data-mongodb-with-cosmos-db Clone the sample project from GitHub to get started with the Spring Data MongoDB example. ```shell git clone https://github.com/spring-guides/gs-accessing-data-mongodb.git ``` -------------------------------- ### Quickstart: Start Service and List Catalog Models Source: https://learn.microsoft.com/en-us/azure/foundry-local/reference/reference-sdk-legacy Use this snippet to verify the SDK can start the service and reach the local catalog. It prints the number of available catalog models. ```javascript import { FoundryLocalManager } from "foundry-local-sdk"; const manager = new FoundryLocalManager(); await manager.startService(); const catalogModels = await manager.listCatalogModels(); console.log(`Catalog models available: ${catalogModels.length}`); ``` -------------------------------- ### Clone Sample Project Source: https://learn.microsoft.com/en-us/azure/azure-monitor/profiler/profiler-containers Clone the sample project repository to get started with the .NET Profiler examples for Azure containers. ```Bash git clone https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore.git ``` -------------------------------- ### Initialize Go Quickstart Project Source: https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/quickstart-go Initialize the project using the Azure Developer CLI with the specified template for Cosmos DB NoSQL and Go. ```Azure CLI azd init --template cosmos-db-nosql-go-quickstart ``` -------------------------------- ### Calculate Duration in Java Source: https://learn.microsoft.com/en-us/azure/durable-task/common/durable-task-code-constraints Use `ctx.getCurrentInstant()` to get the current time. This example calculates the duration between a start time and the current time. ```Java Instant startTime = ctx.getCurrentInstant(); // do some work Duration totalTime = Duration.between(startTime, ctx.getCurrentInstant()); ``` -------------------------------- ### Set up the Node.js application framework Source: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs Create the main application file (index.js) and include the basic framework for the Node.js quickstart. This includes importing necessary modules and setting up the main asynchronous function. ```javascript const { BlobServiceClient } = require("@azure/storage-blob"); const { v1: uuidv1 } = require("uuid"); require("dotenv").config(); async function main() { try { console.log("Azure Blob storage v12 - JavaScript quickstart sample"); // Quick start code goes here } catch (err) { console.err(`Error: ${err.message}`); } } main() .then(() => console.log("Done")) .catch((ex) => console.log(ex.message)); ``` -------------------------------- ### Download and navigate to sample Go web app Source: https://learn.microsoft.com/en-us/azure/developer/go/deploy-container-apps Clone the msdocs-go-webapp-quickstart GitHub repository to your local workstation and then change the directory into the cloned repository. ```bash git clone https://github.com/Azure-Samples/msdocs-go-webapp-quickstart.git cd msdocs-go-webapp-quickstart ``` -------------------------------- ### Get started with the REST APIs Source: https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/authentication-guidance Example for using personal access tokens with Azure DevOps REST APIs for personal/ad hoc scripts. ```bash curl -u :YOUR_PERSONAL_ACCESS_TOKEN \ -H "Content-Type: application/json" \ "https://dev.azure.com/YOUR_COLLECTION/_apis/projects?api-version=6.0" ``` -------------------------------- ### Get Current AKS Arc Version Source: https://learn.microsoft.com/en-us/azure/aks/aksarc/update-akshci-host-powershell Retrieve the currently installed version of AKS Arc on the host. This helps in identifying the starting point before an update. ```PowerShell Get-AksHciVersion ``` -------------------------------- ### Example pod status output Source: https://learn.microsoft.com/en-us/azure/aks/secure-container-access Observe the output of `kubectl get pods` to confirm that the pod has failed to start due to the seccomp filter preventing the 'chmod' command. ```text NAME READY STATUS RESTARTS AGE chmod-prevented 0/1 Error 0 7s ``` -------------------------------- ### Rust SDK Quickstart Source: https://learn.microsoft.com/en-us/azure/foundry-local/reference/reference-sdk-legacy A quickstart example for the Rust SDK to verify service startup and catalog accessibility. It prints the number of available catalog models. ```rust use anyhow::Result; use foundry_local::FoundryLocalManager; #[tokio::main] async fn main() -> Result<()> { let mut manager = FoundryLocalManager::builder().bootstrap(true).build().await?; let models = manager.list_catalog_models().await?; println!("Catalog models available: {}", models.len()); Ok(()) } ``` -------------------------------- ### Example: Configure VM Scale Set Application Startup with Custom Script Source: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-vmss-deployment-v0 This snippet demonstrates configuring application startup on a VM scale set by running a custom script. The custom script and its directory are specified, along with an optional storage account for uploading scripts. ```yaml steps: - task: AzureVmssDeployment@0 displayName: 'Azure VMSS Deployment' inputs: azureSubscription: '' action: 'Configure application startup' vmssName: '' vmssOsType: 'Linux' # or 'Windows' customScriptsDirectory: '."/scripts"' customScript: 'install_app.sh' customScriptArguments: '--port 8080 --config $(config)' customScriptsStorageAccount: '' ``` -------------------------------- ### HTTP-Triggered Client Function Example Source: https://learn.microsoft.com/en-us/azure/azure-functions/durable-functions/quickstart-js-vscode An HTTP-triggered function that starts a 'chainingOrchestration'. It uses the Durable Client input binding to get a client instance and returns a status check response. ```javascript app.http("StartChaining", { route: "StartChaining", methods: ["POST"], authLevel: "anonymous", extraInputs: [df.input.durableClient()], handler: async (request, context) => { const client = df.getClient(context); const instanceId = await client.startNew("chainingOrchestration"); context.log(`Started chaining orchestration with ID = '${instanceId}'.`); return client.createCheckStatusResponse(request, instanceId); }, }); ``` -------------------------------- ### Example Startup Command for .NET Source: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-deployment Use this to specify the startup command for a .NET application on an Azure App Service. ```bash dotnet exec filename.dll ``` -------------------------------- ### Example error message in operator logs Source: https://learn.microsoft.com/en-us/azure/azure-monitor/data-collection/pipeline-configure This error message indicates that the pipeline operator cannot start because the Azure Arc Certificate Manager extension, which provides necessary `ClusterIssuer` resources, is not installed or found. ```text AttemptTlsBootstrap returned an error: failed to apply resource: the server could not find the requested resource (patch clusterissuers.meta.k8s.io arc-amp-selfsigned-cluster-issuer) Please ensure Azure Arc Cert Manager Extension is installed on the cluster. panic: failed to apply resource: the server could not find the requested resource (patch clusterissuers.meta.k8s.io arc-amp-selfsigned-cluster-issuer) ``` -------------------------------- ### Get Change Feed Iterator (Latest Version) in JavaScript Source: https://learn.microsoft.com/en-us/azure/cosmos-db/change-feed-pull-model Obtains an iterator for the change feed in the latest version mode. This example uses ChangeFeedStartFrom.Now() to start reading changes from the current time. ```javascript const options = { changeFeedStartFrom: ChangeFeedStartFrom.Now() }; const iterator = container.items.getChangeFeedIterator(options); ``` -------------------------------- ### Quickstart: Initialize SDK and Access Model Catalog Source: https://learn.microsoft.com/en-us/azure/foundry-local/reference/reference-sdk-current Verify SDK initialization and access to the local model catalog. ```APIDOC ## Quickstart: Initialize SDK and Access Model Catalog ### Description Use this snippet to verify that the SDK can initialize and access the local model catalog. ### Code ```rust use foundry_local_sdk::{FoundryLocalConfig, FoundryLocalManager}; #[tokio::main] async fn main() -> anyhow::Result<()> { let manager = FoundryLocalManager::create(FoundryLocalConfig::new("app-name"))?; let models = manager.catalog().get_models().await?; println!("Models available: {}", models.len()); Ok(()) } ``` ### Usage This example prints the number of models available for your hardware. ``` -------------------------------- ### Start DNN Resource Example Source: https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/failover-cluster-instance-distributed-network-name-dnn-configure Example of starting the DNN resource named 'dnn-demo' online. ```PowerShell Start-ClusterResource -Name dnn-demo ``` -------------------------------- ### Example Startup Command for .NET (alternative) Source: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-deployment An alternative way to specify the startup command for a .NET application on an Azure App Service. ```bash dotnet filename.dll ``` -------------------------------- ### Install Node.js Dependencies and Start Application Source: https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-azure-developer-cli Installs npm dependencies and starts the application. Use this for Node.js projects not directly using 'func start'. ```console npm install npm start ``` -------------------------------- ### Run Go Quickstart Application Source: https://learn.microsoft.com/en-us/azure/ai-foundry/openai/dall-e-quickstart Command to execute the Go quickstart program. This will initiate the image generation process. ```Shell go run quickstart.go ``` -------------------------------- ### Run the setup script Source: https://learn.microsoft.com/en-us/azure/service-bus-messaging/test-locally-with-service-bus-emulator Execute the LaunchEmulator.sh script to start the Service Bus emulator and its SQL Server dependency containers. ```Bash ./Launchemulator.sh ``` -------------------------------- ### Install Dependencies and Start Function App (npm) Source: https://learn.microsoft.com/en-us/azure/azure-functions/scenario-real-time-events-processing Installs project dependencies using npm and then starts the function app using the 'npm start' script. ```bash npm install npm start ``` -------------------------------- ### Example output of the Python quickstart app Source: https://learn.microsoft.com/en-us/azure/storage/queues/storage-quickstart-queues-python This is an example of the output you can expect when running the Azure Queue Storage client library quickstart sample for Python. It shows the lifecycle of a queue and its messages. ```text Azure Queue Storage client library - Python quickstart sample Creating queue: quickstartqueues- Adding messages to the queue... Peek at the messages in the queue... Message: First message Message: Second message Message: Third message Updating the third message in the queue... Receiving messages from the queue... Press Enter key to 'process' messages and delete them from the queue... First message Second message Third message has been updated Press Enter key to delete the queue... Deleting queue... Done ``` -------------------------------- ### Example HTTP GET with Subdirectory Path Source: https://learn.microsoft.com/en-us/azure/data-api-builder/concept/rest/overview Example of an HTTP GET request to an endpoint configured with a subdirectory path. ```HTTP GET /api/shopping-cart/item ``` -------------------------------- ### Run Application Source: https://learn.microsoft.com/en-us/azure/ai-services/content-moderator/client-libraries Executes the Python quickstart file. This command is run from the console. ```Console python quickstart-file.py ``` -------------------------------- ### Example: Install agent version 1.28 on SUSE Source: https://learn.microsoft.com/en-us/azure/azure-arc/servers/manage-agent This is an example of installing agent version 1.28.02260-755 on a SUSE system. ```Bash sudo zypper install -f azcmagent-1.28.02260-755 ``` -------------------------------- ### Quickstart: Full-text search Source: https://learn.microsoft.com/en-us/azure/search/samples-dotnet Create, load, and query an index using sample data. This is a foundational example for basic search functionality. ```csharp // This sample is part of a larger application and requires additional setup. // Refer to the GitHub repository for the complete code and instructions: // https://github.com/Azure-Samples/azure-search-dotnet-samples/blob/main/quickstart-keyword-search/Program.cs ``` -------------------------------- ### Example: Install agent version 1.28 on RHEL/CentOS Source: https://learn.microsoft.com/en-us/azure/azure-arc/servers/manage-agent This is an example of installing agent version 1.28.02260-755 on a RHEL-based system. ```Bash sudo yum install azcmagent-1.28.02260-755 ```