New-AzSubscription vs New-AzSubscriptionAlias

MS Techie 2,756 Reputation points
2021-09-16T16:50:06.753+00:00

What is the best way now to create an Azure Subscription using PowerShell.

Can we use the command New-AzSubscription ? I see lot of articles on internet stating the command is broken . Is this issue fixed.

Now i think there are lot of commands to create new New-AzSubscriptionAlias. is this command in preview ?
https://learn.microsoft.com/en-us/azure/cost-management-billing/manage/programmatically-create-subscription-enterprise-agreement?tabs=azure-powershell

But if i dont want to go for the PREVIEW ones, what is the best way to use GA command to create new subscription

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
Windows for business | Windows Server | User experience | PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 40,081 Reputation points
    2021-09-16T19:37:43.613+00:00

    Hello @MS Techie

    Most of scripts on the internet is possible that are not updated for azure changes in formats or syntaxes. There is a fresh publication from Microsoft on the matter that should work successfully:

    you can find all details here: https://learn.microsoft.com/en-us/azure/cost-management-billing/manage/programmatically-create-subscription-enterprise-agreement?tabs=rest

    Hope this resolves your query,
    Best regards,

    0 comments No comments

  2. Monalla-MSFT 13,166 Reputation points Moderator
    2021-09-17T00:21:03.697+00:00

    @MS Techie - Thanks for reaching out.

    As @Limitless Technology rightly said about the fresh publication from Microsoft.

    To your point, There is no New-AzSubscription command that I'm aware of, the New-AzSubscriptionAlias command is in preview.

    If you want to use PowerShell, youneed to use the New-AzSubscriptionAlias command.

    See this article for more information: programmatically-create-subscription

    Hope this helps.

    If it does, Please feel free to "accept the answer" so it can be beneficial to the community.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.