Is it possible to get Azure Subscription Offer, or offerId, using Powershell? Through the portal this would be Subscription -> properties -> Offer or offer ID?
I've been searching for a while, but I can't see it.
Thanks,
There is an unofficial possibility to get the offer id which is used by the Azure Portal itself. I tested it with my subscription and it worked. It may lead to issues for specific offer ids. Please provide feedback on that.
These are the required steps:
Acquire an Bearer authentication token
Assemble a POST REST call
- URL: https://s2.billing.ext.azure.com/api/Billing/Subscription/Subscription
- Headers: Add the authorization header with your Bearer token (Authorization: Bearer ej...)
- Request Body Type: application/json
- Request Body Content:
{ "subscriptionId": "########-####-####-####-############" }
The result looks like this:
{ "accountInfo": { "userRole": 6, "billingSystemType": 2, "isAccountAdmin": true, "isTokenMatch": false, "locale": "en-US", "currency": "EUR", "countryCode": "DE", "accountAdminEmail": "****@****.com", "commerceAccountId": "########-####-####-####-############", "currencyMigrationInfo": null, "displaySpecifiedRole": false }, "essentials": { "offerId": "MS-AZR-0063P", "roles": { "2": null, "4": { "isDirectCancel": true }, "5": null }, "freeMetersEndDate": null, "provisioningStatus": 1, "hasPendingTransfer": false } }
Depends what do you need it for. There is no point in getting OfferTypes via PS script as you won't be creating the new subscription like this. The process is more complicated than that. Although, if you just need a list, it is available on the MS website: https://azure.microsoft.com/en-us/support/legal/offer-details/
Unfortunally, I don't think it is possible. I think it would be wise to find a work around solution for your problem.
And maybe you could add a request to add this functionality in the future: https://github.com/Azure/azure-docs-powershell/blob/master/azuresmps-4.0.0/AzureRM.Profile/Get-AzureRmSubscription.md
来源:https://stackoverflow.com/questions/52593867/it-is-possible-to-get-the-azure-subscription-offer-or-offerid-with-powershell