Azure Container Instances .NET code samples for documentation

This .NET Core 2.0 console application demonstrates several common Azure Container Instances (ACI) operations in C# using the fluent APIs in the Azure Management Libraries for .NET.

The code in this project is ingested into one or more articles on Modifying the existing #region tags in the sample source may impact the rendering of code snippets on, and is discouraged.


The code in this sample project demonstrates the following operations:

  • Authenticate with Azure
  • Create resource group
  • Create single- and multi-container container groups
    • Expose application container to internet with public DNS name
    • Multi-container group includes both application and sidecar containers
    • Demonstrate async container group create
    • Run a task-based container with custom command line and environment variables
  • Get and print container group details
  • Delete container groups
  • Delete resource group

Getting Started


Run the sample

  1. Use the Azure CLI (or Cloud Shell) to generate an Azure credentials file (more info)

    az ad sp create-for-rbac --sdk-auth > my.azureauth

  2. Set environment variable AZURE_AUTH_LOCATION to the full path of the credentials file

  3. git clone

  4. cd aci-docs-sample-dotnet

  5. dotnet run