Microsoft Azure Batch Management Client Library for Python
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Comprehensive lifecycle management of Azure Batch accounts including creation, configuration, key management, network security settings, and monitoring.
Creates a new Azure Batch account with specified configuration including auto-storage, identity, encryption, and network settings.
def begin_create(
resource_group_name: str,
account_name: str,
parameters: Union[BatchAccountCreateParameters, IO[bytes]],
**kwargs: Any
) -> LROPoller[BatchAccount]:
"""
Creates a new Batch account with the specified parameters.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
parameters (Union[BatchAccountCreateParameters, IO[bytes]]): Account creation parameters
Returns:
LROPoller[BatchAccount]: Long-running operation poller for the created account
"""Retrieves detailed information about an existing Batch account.
def get(
resource_group_name: str,
account_name: str,
**kwargs: Any
) -> BatchAccount:
"""
Gets information about the specified Batch account.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
Returns:
BatchAccount: The Batch account details
"""Updates an existing Batch account's configuration including tags, auto-storage, identity, and encryption settings.
def update(
resource_group_name: str,
account_name: str,
parameters: Union[BatchAccountUpdateParameters, IO[bytes]],
**kwargs: Any
) -> BatchAccount:
"""
Updates a Batch account with the specified parameters.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
parameters (BatchAccountUpdateParameters): Account update parameters
Returns:
BatchAccount: The updated Batch account
"""Deletes a Batch account and all associated resources.
def begin_delete(
resource_group_name: str,
account_name: str,
**kwargs: Any
) -> LROPoller[None]:
"""
Deletes the specified Batch account.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
Returns:
LROPoller[None]: Long-running operation poller for the deletion
"""Lists Batch accounts within resource groups or across the entire subscription.
def list_by_resource_group(
resource_group_name: str,
**kwargs: Any
) -> ItemPaged[BatchAccount]:
"""
Gets information about Batch accounts within the specified resource group.
Args:
resource_group_name (str): The name of the resource group
Returns:
ItemPaged[BatchAccount]: Paginated list of Batch accounts
"""
def list(**kwargs: Any) -> ItemPaged[BatchAccount]:
"""
Gets information about Batch accounts within the subscription.
Returns:
ItemPaged[BatchAccount]: Paginated list of Batch accounts
"""Manages access keys for authenticating with the Batch account.
def get_keys(
resource_group_name: str,
account_name: str,
**kwargs: Any
) -> BatchAccountKeys:
"""
Gets the account keys for the specified Batch account.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
Returns:
BatchAccountKeys: The account keys
"""
def regenerate_key(
resource_group_name: str,
account_name: str,
parameters: BatchAccountRegenerateKeyParameters,
**kwargs: Any
) -> BatchAccountKeys:
"""
Regenerates the specified account key for the Batch account.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
parameters (BatchAccountRegenerateKeyParameters): Regeneration parameters
Returns:
BatchAccountKeys: The new account keys
"""Manages auto-storage account synchronization for seamless integration with Azure Storage.
def synchronize_auto_storage_keys(
resource_group_name: str,
account_name: str,
**kwargs: Any
) -> None:
"""
Synchronizes access keys for the auto-storage account configured for the Batch account.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
"""Gets information about available detectors for monitoring and diagnostics.
def list_detectors(
resource_group_name: str,
account_name: str,
**kwargs: Any
) -> ItemPaged[DetectorResponse]:
"""
Gets information about the detectors available for a given Batch account.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
Returns:
ItemPaged[DetectorResponse]: Paginated list of available detectors
"""def get_detector(
resource_group_name: str,
account_name: str,
detector_id: str,
**kwargs: Any
) -> DetectorResponse:
"""
Gets information about the given detector for a given Batch account.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
detector_id (str): The name of the detector
Returns:
DetectorResponse: Information about the specified detector
"""Retrieves outbound network dependency endpoints for network configuration and firewall setup.
def list_outbound_network_dependencies_endpoints(
resource_group_name: str,
account_name: str,
**kwargs: Any
) -> ItemPaged[OutboundEnvironmentEndpoint]:
"""
Gets the list of outbound network dependency endpoints for the Batch account.
Args:
resource_group_name (str): The name of the resource group
account_name (str): The name of the Batch account
Returns:
ItemPaged[OutboundEnvironmentEndpoint]: Network dependency endpoints
"""class BatchAccountCreateParameters:
location: str
tags: dict
identity: BatchAccountIdentity
auto_storage: AutoStorageBaseProperties
pool_allocation_mode: PoolAllocationMode
public_network_access: PublicNetworkAccessType
network_profile: NetworkProfile
encryption: EncryptionProperties
class BatchAccountUpdateParameters:
tags: dict
identity: BatchAccountIdentity
auto_storage: AutoStorageProperties
encryption: EncryptionProperties
public_network_access: PublicNetworkAccessType
network_profile: NetworkProfile
class BatchAccountIdentity:
type: ResourceIdentityType
user_assigned_identities: dict
principal_id: str
tenant_id: str
class AutoStorageProperties:
storage_account_id: str
authentication_mode: AutoStorageAuthenticationMode
node_identity_reference: ComputeNodeIdentityReference
last_key_sync: datetime
class NetworkProfile:
account_access: EndpointAccessProfile
node_management_access: EndpointAccessProfile
class EncryptionProperties:
key_source: KeySource
key_vault_properties: KeyVaultPropertiesclass BatchAccount:
id: str
name: str
type: str
location: str
tags: dict
identity: BatchAccountIdentity
provisioning_state: ProvisioningState
account_endpoint: str
node_management_endpoint: str
auto_storage: AutoStorageProperties
encryption: EncryptionProperties
dedicated_core_quota: int
low_priority_core_quota: int
dedicated_core_quota_per_vm_family: list
pool_allocation_mode: PoolAllocationMode
public_network_access: PublicNetworkAccessType
network_profile: NetworkProfile
class BatchAccountKeys:
account_name: str
primary: str
secondary: str
class BatchAccountRegenerateKeyParameters:
key_name: AccountKeyType
class DetectorResponse:
id: str
name: str
type: str
properties: dictfrom azure.mgmt.batch.models import (
BatchAccountCreateParameters,
AutoStorageBaseProperties,
PoolAllocationMode,
PublicNetworkAccessType
)
# Configure auto-storage
auto_storage = AutoStorageBaseProperties(
storage_account_id="/subscriptions/.../storageAccounts/mystorageaccount"
)
# Create account parameters
account_params = BatchAccountCreateParameters(
location="East US",
auto_storage=auto_storage,
pool_allocation_mode=PoolAllocationMode.BATCH_SERVICE,
public_network_access=PublicNetworkAccessType.ENABLED
)
# Create the account
operation = client.batch_account.create(
"my-resource-group",
"my-batch-account",
account_params
)
account = operation.result()
print(f"Created account: {account.name}")# Get current keys
keys = client.batch_account.get_keys("my-resource-group", "my-batch-account")
print(f"Primary key: {keys.primary}")
# Regenerate primary key
from azure.mgmt.batch.models import BatchAccountRegenerateKeyParameters, AccountKeyType
regen_params = BatchAccountRegenerateKeyParameters(key_name=AccountKeyType.PRIMARY)
new_keys = client.batch_account.regenerate_key(
"my-resource-group",
"my-batch-account",
regen_params
)
print(f"New primary key: {new_keys.primary}")Install with Tessl CLI
npx tessl i tessl/pypi-azure-mgmt-batch