page_type | languages | products | description | urlFragment | ||
---|---|---|---|---|---|---|
sample |
|
|
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. |
aci-docs-sample-dotnet |
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 docs.microsoft.com. Modifying the existing #region
tags in the sample source may impact the rendering of code snippets on docs.microsoft.com, 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
- Azure subscription
- Microsoft .NET Core SDK version 2.1.2+
-
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
-
Set environment variable
AZURE_AUTH_LOCATION
to the full path of the credentials file -
git clone https://github.com/Azure-Samples/aci-docs-sample-dotnet
-
cd aci-docs-sample-dotnet
-
dotnet run