It is easy to create a Azure Data Factory using PowerShell. However, you might fail to create one if you follow Microsoft’s Example without upgrading your PowerShell.
Prerequisites: you need to have a valid Azure Subscription and a resource group.
Step 1: Login Azure Account. run the following command. It will pop up a windows. You simply enter your username and password.
Step 2: Find your subscription. The following command will show you all subscriptions.
Step 3: Choose your subscription. If you have multiple subscriptions, you need to choose which one you want to use. You need the subscription Id which you can find from the result of step 2.
Select-AzureRmSubscription -SubscriptionID “you subscription Id”
Step 4: Define resource group name and data factory name parameters. You need to know which resource group do you want to put your data factory. If you don’t remember the resource group name, you can get all your resource group names by running Get-AzureRmResourceGroup command. The data factory name must start with a letter or a number, and can contain only letters, numbers, and the dash (-) character. That means you can not use underscore which usually can be used for naming. Data factory name should be at least 3 characters long and no more than 63 characters long. You can check here for the data factory naming convention.
$resourceGroupName = “Your existing resource group name”;
$dataFactoryName = “Your Data Factory Name”;
Step 5: Create new data factory. In my case, you should use New-AzureRmDataFactory instead of Set-AzureRmDataFactoryV2 command.
New-AzureRmDataFactory -ResourceGroupName $resourceGroupName -Location “East US” -Name $dataFactoryName;
If everything runs well, you should see a similar screen shot shown as below.