1️⃣ List All API Management Subscriptions
az rest --method get --url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ApiManagement/service/<apim-name>/subscriptions?api-version=2021-08-01" --query "value[].{ID:id, Name:name, DisplayName:properties.displayName, State:properties.state}" --output table
✅ Shows: Subscription Name, Display Name, and State.
2️⃣ Get Details of a Specific Subscription
az rest --method get --url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ApiManagement/service/<apim-name>/subscriptions/<subscription-name>?api-version=2021-08-01" --output json
✅ Shows: Creation Date, Scope, Expiry, and Status.
3️⃣ List API Subscription Owners
az rest --method get --url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ApiManagement/service/<apim-name>/subscriptions?api-version=2021-08-01" --query "value[].{Name:name, Owner:properties.ownerId, State:properties.state}" --output table
✅ Shows: Subscription Name, Owner ID, and Status.
4️⃣ List Subscriptions and Their Linked Products
az rest --method get --url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ApiManagement/service/<apim-name>/subscriptions?api-version=2021-08-01" --query "value[].{Name:name, Product:properties.scope}" --output table
✅ Shows: Subscription Name and the APIM Product it's linked to.
5️⃣ Export Subscription Data to a File
If you want to save the results to a JSON or CSV file:
az rest --method get --url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ApiManagement/service/<apim-name>/subscriptions?api-version=2021-08-01" --output json > apim_subscriptions.json
or for CSV format:
az rest --method get --url "https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ApiManagement/service/<apim-name>/subscriptions?api-version=2021-08-01" --query "value[].{Name:name, Product:properties.scope}" --output tsv > apim_subscriptions.csv
🚀 Join the DevOps Dojo! 🌟
Are you passionate about growth, learning, and collaboration in the world of DevOps? The DevOps Dojo is your new home! Whether you’re just starting out or looking to refine your skills, this vibrant community is here to support your journey.
🔧 What You’ll Get:
- Access to expert-led discussions
- Hands-on learning opportunities
- Networking with like-minded professionals
Ready to take your DevOps game to the next level? Click below to learn more and join the community!
Let’s build, grow, and thrive together! 🌐