airflow.providers.microsoft.azure.hooks.compute¶
Classes¶
A hook to interact with Azure Compute to manage Virtual Machines. |
Module Contents¶
- class airflow.providers.microsoft.azure.hooks.compute.AzureComputeHook(azure_conn_id=default_conn_name)[source]¶
Bases:
airflow.providers.microsoft.azure.hooks.base_azure.AzureBaseHookA hook to interact with Azure Compute to manage Virtual Machines.
- Parameters:
azure_conn_id (str) – Azure connection id of a service principal which will be used to manage virtual machines.
- get_conn()[source]¶
Authenticate the resource using the connection id passed during init.
- Returns:
the authenticated ComputeManagementClient.
- Return type:
azure.mgmt.compute.ComputeManagementClient
- start_instance(resource_group_name, vm_name, wait_for_completion=True)[source]¶
Start a virtual machine instance.
- stop_instance(resource_group_name, vm_name, wait_for_completion=True)[source]¶
Stop (deallocate) a virtual machine instance.
Uses
begin_deallocateto release compute resources and stop billing.
- restart_instance(resource_group_name, vm_name, wait_for_completion=True)[source]¶
Restart a virtual machine instance.
- async get_async_conn()[source]¶
Return an authenticated async
ComputeManagementClient.Supports service-principal (login/password + tenantId) and DefaultAzureCredential auth. Legacy
key_path/key_jsonauth files are not supported in the async path.