Hi @Nguyen Linh
Apologies for the late reply. I'm not well versed in the Azure Python SDK, but I believe azure.mgmt.network.operations.ApplicationGatewaysOperations class | Microsoft Learn is what you're looking for. Unfortunately, there isn't much usage documentation to go on. I used an AI assist tool, and it provided the following snippet. Now unfortunately, I could not find get_backend_health
but the doc does mention begin_backend_health
. It's something to start with.
from azure.identity import DefaultAzureCredential
from azure.mgmt.network import NetworkManagementClient
# Initialize the Network Management Client
credential = DefaultAzureCredential()
network_client = NetworkManagementClient(credential, "your_subscription_id")
# Specify the resource group and application gateway name
resource_group_name = "your_resource_group"
application_gateway_name = "your_application_gateway"
# Get the backend health for the specified application gateway
backend_health = network_client.application_gateways.get_backend_health(
resource_group_name,
application_gateway_name
)
# Process the backend health data as needed
for backend_pool in backend_health.backend_address_pools:
print(f"Backend pool ID: {backend_pool.backend_address_pool.id}")
for http_settings in backend_pool.backend_http_settings_collection:
for server in http_settings.servers:
print(f"Server address: {server.address}, Health: {server.health}")