Create EA subscription with PowerShell

First I configure Visual Studio Code to work together with Azure Cloud Shell. To begin we have 2 prerequisites.

  1. Install node.js,
  2. Install Visual Studio Code Azure Account extension from within application

You can now type CTRL+SHIFT+P from within Visual Studio Code, this should present you with the option to launch cloud shell.

Now it’s almost business as usual. Login with your account that has access to create Azure EA subscriptions. Upload your CSV file. I have used a CSV file with these columns.

#Create Azure Subscriptions
#Install module
Install-Module Az.Subscription -AllowPrerelease -AllowClobber

#Get data from CSV
$SubscriptionsCSV = Import-Csv -Path $HOME\users.csv -Delimiter -Encoding "UTF8"

foreach ($user In $users){
    $subname = ("<EnterName>" + ' ' + $user.'costcenter' + ' ' + $user.'email')
    $newsub = New-AzSubscription -OfferType MS-AZR-0017P -Name $subname -EnrollmentAccountObjectId <ObjectIDOFEnrollmentaccount> -OwnerSignInName $user.'email'

Hope this will help you if you will create many azure subscriptions. Good to know is the limit of 200 subscription/provision account.

Best regards

Jimmy Lindö