Skip to content

Commit 3da3920

Browse files
authored
Merge pull request #591 from soma-ms/vekandib/fix-globalparamupdatescript-githubrepo
Fix for factory update resetting github repoConfig
2 parents b3a87c5 + 762da40 commit 3da3920

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

SamplesV2/ContinuousIntegrationAndDelivery/GlobalParametersUpdateScript.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Import-Module Az.DataFactory
99

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

12+
Write-Warning "This method of deploying global parameters using PS script is not recommended. Please use the new mechanism as per this document https://learn.microsoft.com/en-us/azure/data-factory/author-global-parameters#cicd"
13+
1214
Write-Host "Getting global parameters JSON from: " $globalParametersFilePath
1315
$globalParametersJson = Get-Content $globalParametersFilePath
1416

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

18-
# $gp in $factoryFileObject.properties.globalParameters.GetEnumerator())
19-
# may be used in case you use non-standard location for global parameters. It is not recommended.
2020
foreach ($gp in $globalParametersObject.GetEnumerator()) {
2121
Write-Host "Adding global parameter:" $gp.Key
2222
$globalParameterValue = $gp.Value.ToObject([Microsoft.Azure.Management.DataFactory.Models.GlobalParameterSpecification])
@@ -28,4 +28,8 @@ $dataFactory.GlobalParameters = $newGlobalParameters
2828

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

31-
Set-AzDataFactoryV2 -InputObject $dataFactory -Force
31+
if ($dataFactory.RepoConfiguration -and ($dataFactory.RepoConfiguration.GetType().Name -eq 'FactoryGitHubConfiguration') -and (-not $dataFactory.RepoConfiguration.HostName)) {
32+
$dataFactory.RepoConfiguration.HostName = 'https://github.com'
33+
}
34+
35+
Set-AzDataFactoryV2 -InputObject $dataFactory -Force

0 commit comments

Comments
 (0)