Microsoft Azure Market Place Ordering Client Library for Python
This is the Microsoft Azure Market Place Ordering Client Library for Python, enabling management of marketplace agreements within Azure. It's part of the Azure SDK for Python and uses Azure Resource Manager (ARM) APIs. The current stable version is 1.1.0, released in March 2021. The package generally follows a stable release cadence, with updates primarily for API version bumps or minor features, reflecting the management plane operations it supports.
Warnings
- breaking The credential system was completely revamped in version 1.0.0b1. Older `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported.
- breaking Starting from version 0.2.0, all model signatures and client methods primarily use keyword-only arguments. Positional arguments for models are no longer supported.
- gotcha The `config` attribute is no longer available on client objects since version 1.0.0b1. Client configuration must be passed as keyword arguments during instantiation.
- deprecated Support for Python 2.7 has officially ended for Azure SDK Python packages as of January 1, 2022. This library is tested with Python 3.8+.
Install
-
pip install azure-mgmt-marketplaceordering azure-identity
Imports
- MarketplaceOrderingAgreements
from azure.mgmt.marketplaceordering import MarketplaceOrderingAgreements
Quickstart
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.marketplaceordering import MarketplaceOrderingAgreements
# Set environment variables AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET, AZURE_SUBSCRIPTION_ID
sub_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "")
if not sub_id:
raise ValueError("AZURE_SUBSCRIPTION_ID environment variable not set.")
# Authenticate using DefaultAzureCredential
credential = DefaultAzureCredential()
# Create the client
client = MarketplaceOrderingAgreements(credential=credential, subscription_id=sub_id)
# Example: List marketplace agreements (this operation may require specific permissions)
# Replace 'publisherId' and 'offerId' with actual values if needed for listing or getting a specific agreement
# For simplicity, this example just attempts to list, which might be empty or require specific resources.
# Real-world usage often involves 'get' and 'create_or_update' based on a specific offer.
print("Attempting to list marketplace agreements...")
agreements = client.marketplace_agreements.list()
for agreement in agreements:
print(f"Agreement: {agreement.name} (Publisher: {agreement.publisher_id}, Offer: {agreement.offer_id})")
print("Quickstart complete.")