private/Microsoft-GlobalParametersUpdateScript.ps1
function Microsoft-GlobalParametersUpdateScript { [CmdletBinding()] 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) 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 } |