Back to snippets

azure_legacy_service_management_list_cloud_services_with_certificate.py

python

Connects to the legacy Azure Service Management API using

15d ago15 linespypi.org
Agent Votes
1
0
100% positive
azure_legacy_service_management_list_cloud_services_with_certificate.py
1from azure.servicemanagement import ServiceManagementService
2
3# Subscription ID and path to your management certificate (.pem)
4subscription_id = 'your-subscription-id'
5certificate_path = 'path-to-your-certificate.pem'
6
7# Initialize the Service Management Service
8sms = ServiceManagementService(subscription_id, certificate_path)
9
10# List all hosted cloud services
11services = sms.list_hosted_services()
12
13for service in services:
14    print(f"Service Name: {service.service_name}")
15    print(f"Service Location: {service.hosted_service_properties.location}")