【问题标题】:How to create a Integration Runtime with Managed Virtual Network using PowerShell如何使用 PowerShell 创建具有托管虚拟网络的集成运行时
【发布时间】:2021-07-03 04:59:47
【问题描述】:

我想创建一个带有托管虚拟网络的 Azure 托管集成运行时。 我可以使用 ADF 界面创建它,但是我想编写它的脚本。

这是我正在使用的代码。

Set-AzDataFactoryV2IntegrationRuntime -Name $adfIntegrationRuntimeName `
-ResourceGroupName $adf.ResourceGroupName `
-DataFactoryName $adf.DataFactoryName `
-Type Managed `
-Description $adfIntegrationRuntimeDescription `
-Location $adf.Location `
-DataFlowTimeToLive 10 `
-DataFlowComputeType General `
-DataFlowCoreCount 8

这是使用 UI 的结果:

这是使用 PowerShell 代码的结果:

您知道如何使用 PowerShell 预配托管在 Azure 上的 IR 子类型为“托管虚拟网络”吗?

【问题讨论】:

    标签: azure-powershell azure-data-factory-2


    【解决方案1】:

    正如您在 Azure 门户 UI 中看到的,此配置只是预览版,在命令 Set-AzDataFactoryV2IntegrationRuntime 中没有内置参数来配置此,如果您想通过 powershell 进行配置,您可以调用 REST API - Integration Runtimes - Create Or Update 直接在 powershell 中。

    示例:

    $adfIntegrationRuntimeName = "test1"
    $adfIntegrationRuntimeDescription = "123"
    $ResourceGroupName = "xxxx"
    $ADFname = "joyfactory"
    $adf = Get-AzDataFactoryV2 -ResourceGroupName $ResourceGroupName -Name $ADFname
    $path = $adf.DataFactoryId + "/integrationruntimes/" + $adfIntegrationRuntimeName + "?api-version=2018-06-01"
    
    $payload = @{
        "name" = $adfIntegrationRuntimeName
        "properties" = @{
            "type" = "Managed"
            "description" = $adfIntegrationRuntimeDescription
            "typeProperties" = @{
                "computeProperties" = @{
                    "location" = $adf.Location
                    "dataFlowProperties" = @{
                        "computeType" = "General"
                        "coreCount" = 8
                        "timeToLive" =  10
                    }
                }
            }
            "managedVirtualNetwork" = @{
                "type" = "ManagedVirtualNetworkReference"
                "referenceName" = "default"
            }
        }
    } | ConvertTo-Json -Depth 10
    
    Invoke-AzRestMethod -Path $path -Method PUT -Payload $payload
    

    注意:下面的选项不会映射到Code,所以如果要启用它,还需要在上面的命令之后运行下面的命令。

    $path2 = $adf.DataFactoryId + "/integrationruntimes/" + $adfIntegrationRuntimeName + "/enableInteractiveQuery" + "?api-version=2018-06-01"
    Invoke-AzRestMethod -Path $path2 -Method POST -Payload '{"autoTerminationMinutes":60}'
    

    在门户中检查结果,它工作正常。

    【讨论】:

    • 太棒了!我已经尝试过了,它完美无缺。谢谢你的回答。
    猜你喜欢
    • 1970-01-01
    • 2021-08-31
    • 2020-07-05
    • 2016-04-11
    • 2016-10-12
    • 2021-12-01
    • 2017-09-21
    • 1970-01-01
    • 2021-05-15
    相关资源
    最近更新 更多