It is possible to get the Azure Subscription offer, or offerId with PowerShell?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 03:17:51

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:

  1. Acquire an Bearer authentication token

  2. Assemble a POST REST call

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!