Creating Data Factory with Powershell

Debbie Edwards 521 Reputation points
2023-03-02T10:35:26.5233333+00:00

I am attempting to create all my Azure resources with powershell but I cant create the data Factory

I am trying the following

$RG = "dev-uks-project-rg"

$ADFName = "dev-uks-project-adf"

$Location = "UK South"

 New-AzDataFactory -ResourceGroupName $RG -Name $ADFName –Location $Location

But I get the error

New-AzDataFactory : HTTP Status Code: BadRequest
Error Code: LocationNotAvailableForResourceType
Error Message: The provided location 'UK South' is not available for resource type
'Microsoft.DataFactory/dataFactories'. List of available regions for the resource type is
'westus,northeurope,eastus,westcentralus'.
Request Id: 3076e363-45f7-4003-991d-11a3ebd48c73
Timestamp (Utc):03/02/2023 10:27:39
At line:5 char:1
+ New-AzDataFactory -ResourceGroupName $RG -Name $ADFName –Location $Lo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzDataFactory], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.DataFactories.NewAzureDataFactoryCommand

If I create it in azure Portal I can create in on UK South so my first question here is... Is there possibly another module I need to install before running this? UK south is definitely available so how can I use it.

The next part of the issue is when I attempt to create via northeurope

I get the below message so again Im wondering if there is something else i need to install for data factory?

New-AzDataFactory : HTTP Status Code: BadRequest
Error Code: DataFactoryCreationNotAllowedV2
Error Message: Data factory creation is currently disabled for tenant xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
subscription xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx in the northeurope region.
Request Id: 87864b87-aaa2-4f44-9d1f-99c8b84aa381
Timestamp (Utc):03/02/2023 10:32:57
At line:5 char:1
+ New-AzDataFactory -ResourceGroupName $RG -Name $ADFName –Location $Lo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [New-AzDataFactory], CloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.DataFactories.NewAzureDataFactoryCommand
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,442 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,007 questions
{count} votes

Accepted answer
  1. BhargavaGunnam-MSFT 25,796 Reputation points Microsoft Employee
    2023-03-07T19:05:10.9833333+00:00

    Hi Debbie Edwards,

    Thanks for the reply.

    After further research, I found that you are using the command to deploy the Azure data factory V1 version. The error message you were seeing is correct, as ADF V1 is only available in specific regions.

    In order to deploy ADF v2, please use the below PS command.

    Set-AzDataFactoryV2 -ResourceGroupName "ADF" -Name "WikiADF" -Location "WestUS"

    Reference document: https://learn.microsoft.com/en-us/powershell/module/az.datafactory/set-azdatafactoryv2?view=azps-9.4.0&viewFallbackFrom=azps-6.4.0

    I hope this helps. Please let me know if you have any further questions.

    If this answers your question, please consider accepting the answer by hitting the Accept answer and up-vote as it helps the community look for answers to similar questions.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more