Skip to content

Python application demonstrating several common operations in Azure Container Instances (ACI). The code in this project backs one or more articles on docs.microsoft.com.

License

Notifications You must be signed in to change notification settings

kazrael2119/aci-docs-sample-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

page_type languages products description urlFragment
sample
python
azure
This sample application demonstrates several common Azure Container Instances operations in Python using the Azure libraries for Python.
aci-docs-sample-python

Azure Container Instances Python code samples for documentation

This sample application demonstrates several common Azure Container Instances operations in Python using the Azure libraries for Python.

The code in this project is ingested into one or more articles on docs.microsoft.com. Modifying the code in the sample source may impact the rendering of code snippets on docs.microsoft.com.

This sample has been tested as functional on Python versions 2.7.15rc1 and 3.6.5.

Features

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
    • Run a task-based container with custom command line and environment variables
  • List container groups in resource group
  • Get and print container group details
  • Delete container groups
  • Delete resource group

Getting Started

Prerequisites

Run the sample

  1. Optional but recommended, use virtualenv to create and activate a virtual environment for the project:

    virtualenv ~/venv/aci-docs-sample-python
    source ~/venv/aci-docs-sample-python/bin/activate
    
  2. Use the Azure CLI (or Cloud Shell) to generate an Azure credentials file (more authentication details)

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

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

  4. git clone https://github.com/Azure-Samples/aci-docs-sample-python

  5. cd aci-docs-sample-python

  6. pip install -r src/requirements.txt

  7. python src/aci_docs_sample.py

    ...sample runs...

  8. Exit virtualenv (if using a virtual environment): deactivate

Resources

About

Python application demonstrating several common operations in Azure Container Instances (ACI). The code in this project backs one or more articles on docs.microsoft.com.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%