Get Offer ID programmatically through PowerShell / Azure CLI
It's not possible to get a subscriptions offer id through API today. It's needed to programmatically be able to use the rate card api since you need the offer id.
still not available! Almost essential to scripting in a large subscription environment. When can we expect its inclusion?
cannot understand how this is not provided, not even as a column when viewing the Azure Subscriptions in Azure Portal..
Ken H commented
Still hoping for a solution to this one. This is a strange omission.
Doing this via Graph from PowerShell is slow and technically complex. Please simply add it into the ExtendedProperties bag from Get-AzSubscription.
Jarrod Johnston commented
Thanks Jack, this was very helpful! I tried to use the statement below and it didn't work for me. For some reason I had to reverse single and double-quotes to get it to work.
Jack Chen commented
I asked this feature in https://github.com/Azure/azure-cli/issues/11369
It can be done by graph query:
az extension add --name resource-graph ## install the graph extension
az graph query -q 'resourcecontainers | where type == "microsoft.resources/subscriptions" | where properties.state != "Disabled" | project subscriptionId, name, properties.subscriptionPolicies.quotaId'
Why isnt this here already! I definitely need this via powershell - I can use the rest api to get it but I want access via POSH. thx
Bryan Dougherty commented
We also need the ability to query Azure via PowerShell to pull this detail for all of our subscriptions.
The thing is that without proper offer Id, I cannot read correct prices and entire pricing API is useless.
Mikael R. Karlsson commented
I would really like to see that all Properties available for an Subscription object is retrievable programatically through API, it would simplify the work alot when you have some 100+ subscriptions with different offers.