【问题标题】:GlobalParametersUpdateScript.ps1 is resetting Azure Data Factory Public Network AccessGlobalParametersUpdateScript.ps1 正在重置 Azure 数据工厂公共网络访问
【发布时间】:2022-06-17 17:57:05
【问题描述】:

我有 Azure 数据工厂 CI/CD 管道。我的 ADF 几乎没有全局参数,因此我关注 Microsoft documentation 获取他们的 CI/CD。在同一 documentation 页面上,下面有“更新全局参数”powershell 脚本。问题是每当此脚本运行时,它都会将我的 ADF 网络访问权限从“私有端点”重置为“公共端点”。

param
(
    [parameter(Mandatory = $true)] [String] $globalParametersFilePath,
    [parameter(Mandatory = $true)] [String] $resourceGroupName,
    [parameter(Mandatory = $true)] [String] $dataFactoryName
)

Import-Module Az.DataFactory

$newGlobalParameters = New-Object 'system.collections.generic.dictionary[string,Microsoft.Azure.Management.DataFactory.Models.GlobalParameterSpecification]'

Write-Host "Getting global parameters JSON from: " $globalParametersFilePath
$globalParametersJson = Get-Content $globalParametersFilePath

Write-Host "Parsing JSON..."
$globalParametersObject = [Newtonsoft.Json.Linq.JObject]::Parse($globalParametersJson)

# $gp in $factoryFileObject.properties.globalParameters.GetEnumerator()) 
# may  be used in case you use non-standard location for global parameters. It is not recommended. 
foreach ($gp in $globalParametersObject.GetEnumerator()) {
    Write-Host "Adding global parameter:" $gp.Key
    $globalParameterValue = $gp.Value.ToObject([Microsoft.Azure.Management.DataFactory.Models.GlobalParameterSpecification])
    $newGlobalParameters.Add($gp.Key, $globalParameterValue)
}

$dataFactory = Get-AzDataFactoryV2 -ResourceGroupName $resourceGroupName -Name $dataFactoryName
$dataFactory.GlobalParameters = $newGlobalParameters

Write-Host "Updating" $newGlobalParameters.Count "global parameters."

Set-AzDataFactoryV2 -InputObject $dataFactory -Force

我希望始终通过“私有端点”进行网络访问。有人遇到过这个问题吗?

【问题讨论】:

    标签: azure-devops azure-pipelines azure-data-factory azure-virtual-network azure-deployment


    【解决方案1】:

    只需将全局参数脚本的最后一行更改如下:

    Set-AzDataFactoryV2 -InputObject $dataFactory -PublicNetworkAccess "Disabled" -Force
    

    现在您的 ADF 网络访问权限不会重置为公共访问权限。

    【讨论】:

      猜你喜欢
      • 2023-01-31
      • 1970-01-01
      • 2022-06-21
      • 2022-11-10
      • 2023-01-05
      • 2020-08-21
      • 1970-01-01
      • 1970-01-01
      • 2021-01-07
      相关资源
      最近更新 更多