User Tools

Site Tools


informatica:linux:azure

Azure SDK python

Ejemplillo:

from os import environ

# DEBUG
environ = {
    "AZURE_SUBSCRIPTION_ID": "my_subscription_id",
    "RESOURCE_GROUP_NAME": "my_resource_group",
    "LOCATION": "westeurope",
}

# Import the needed management objects from the libraries. The azure.common library
# is installed automatically with the other libraries.
from azure.identity import AzureCliCredential
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.storage import StorageManagementClient

# Acquire a credential object using CLI-based authentication.
credential = AzureCliCredential()

# Retrieve subscription ID from environment variable.
subscription_id = environ["AZURE_SUBSCRIPTION_ID"]

# Obtain the management object for resources.
resource_client = ResourceManagementClient(credential, subscription_id)

# Step 1: Provision the resource group.

rg_result = resource_client.resource_groups.create_or_update(environ["RESOURCE_GROUP_NAME"],
    { "location": environ["LOCATION"] })
informatica/linux/azure.txt · Last modified: 2022/09/26 11:41 by javi