创建Azure数据工厂集成运行时(如果它不存在) - Azure PowerShell

问题描述 投票:0回答:2

我已经在Azure门户中创建了Azure Data Factory Integration Runtime,现在想要通过PowerShell脚本创建

   $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"
}

当我运行脚本时,它不会显示来自else块的消息。任何人都可以帮助enter image description here

azure powershell azure-data-factory azure-powershell
2个回答
0
投票

我尝试了相同的代码,它对我有用。如果你想交叉验证,你可以通过调用下面的函数来做到这一点。

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

希望能帮助到你。


0
投票

你必须调整你的if语句:

if($null -eq $IR)
© www.soinside.com 2019 - 2024. All rights reserved.