Skip to content
An example illustrating how to use Python to manipulate resources and resource groups in Hybrid cloud environments. Eg. AzureStack
Python
Branch: master
Clone or download
Latest commit cec716f Sep 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Initial commit Dec 10, 2018
.gitignore Initial commit Dec 10, 2018
CHANGELOG.md Add manage resources sample (#1) Dec 10, 2018
CONTRIBUTING.md Add manage resources sample (#1) Dec 10, 2018
LICENSE.md Initial commit Dec 10, 2018
README.md Update README.md Sep 12, 2019
example.py Add manage resources sample (#1) Dec 10, 2018
requirements.txt Add manage resources sample (#1) Dec 10, 2018

README.md

page_type languages products description urlFragment
sample
python
azure
This sample explains how to manage your resources and resource groups in Azure Stack using the Azure Python SDK.
Hybrid-ResourceManager-Python-Manage-Resources

Hybrid-ResourceManager-Python-Manage-Resources

This sample explains how to manage your resources and resource groups in Azure Stack using the Azure Python SDK.

On this page

  • Run this sample
  • What is example.py doing?
    • List resource groups
    • Create a resource group
    • Update a resource group
    • Create a key vault in the resource group
    • List resources within the group
    • Export the resource group template
    • Delete a resource group

Run this sample

  1. If you don't already have it, install Python.

  2. We recommend to use a virtual environnement to run this example, but it's not mandatory. You can initialize a virtualenv this way:

    pip install virtualenv
    virtualenv mytestenv
    cd mytestenv
    source bin/activate
    
  3. Clone the repository.

    git clone https://github.com/Azure-Samples/Hybrid-ResourceManager-Python-Manage-Resources.git
    
  4. Install the dependencies using pip.

    cd Hybrid-ResourceManager-Python-Manage-Resources
    pip install -r requirements.txt
    
  5. Create a service principal to work against AzureStack. Make sure your service principal has contributor/owner role on your subscription.

  6. Export these environment variables into your current shell.

    export AZURE_RESOURCE_LOCATION={your resource location}
    export AZURE_TENANT_ID={your tenant id}
    export AZURE_CLIENT_ID={your client id}
    export AZURE_CLIENT_SECRET={your client secret}
    export AZURE_SUBSCRIPTION_ID={your subscription id}
    export ARM_ENDPOINT={your AzureStack Resource Manager Endpoint}
    
  7. Run the sample.

    python example.py
    
You can’t perform that action at this time.