3355307
3355307

Reputation: 1678

Create Azure Data Factory Integration Runtime if it does not exist - Azure PowerShell

I have already created Azure Data Factory Integration Runtime in Azure Portal and now want to create via PowerShell script

   $IR = Get-AzDataFactoryV2IntegrationRuntime -DataFactoryName "CappDashboardDataFactory" -ResourceGroupName "ADFResourceGroup" -Name "CappDashboardDataFactory-Selfhosted-IR"
if(-not $IR)
{
Set-AzDataFactoryV2IntegrationRuntime -ResourceGroupName "ADFResourceGroup" -DataFactoryName "CappDashboardDataFactory" -Name "CappDashboardDataFactory-Selfhosted-IR" -Type SelfHosted -Description "selfhosted IR description"
# created successfully
 Write-Output "Created Successfully"
}
else
{
 # already exists
 Write-Output "Already Exists"
}

when i run script it does not display message from else block. can anyone help enter image description here

Upvotes: 1

Views: 562

Answers (2)

Alexander Ahrens
Alexander Ahrens

Reputation: 76

You have to adjust your if statement:

if($null -eq $IR)

Upvotes: 0

Mohit Verma
Mohit Verma

Reputation: 5294

I tried the same code ,it worked for me .still if you want to cross verify , you can do that by calling below function.

Get-AzDataFactoryV2IntegrationRuntime -ResourceGroupName rg-test-dfv2 -DataFactoryName test-df-eu2 -Name test-dedicated-ir

It will give you following result which you can verify later

    Location                     : West US
    NodeSize                     : Standard_D1_v2
    NodeCount                    : 1
    MaxParallelExecutionsPerNode : 1
    CatalogServerEndpoint        : test.database.windows.net
    CatalogAdminUserName         : test
    CatalogAdminPassword         : **********
    CatalogPricingTier           : S1
    VNetId                       : 
    Subnet                       : 
    State                        : Starting
    ResourceGroupName            : rg-test-dfv2
    DataFactoryName              : test-df-eu2
    Name                         : test-dedicated-ir
    Description                  : Reserved IR

Hope it helps.

Upvotes: 1

Related Questions