Skip to content

Commit

Permalink
Fix Invalid URI issue when passing diaplsy name of location (+1 squas…
Browse files Browse the repository at this point in the history
…hed commits)

Squashed commits:

[bc81f1915fb] Fix Invalid URI issue when passing diaplsy name of location
  • Loading branch information
yinghsugn committed Feb 14, 2023
1 parent 28ff1d7 commit c893de7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ConnectedKubernetes/custom/New-AzConnectedKubernetes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,15 @@ function New-AzConnectedKubernetes {
} else {
$ReleaseTrain = 'stable'
}
$ChartLocationUrl = "https://${Location}.dp.kubernetesconfiguration.azure.com/azure-arc-k8sagents/GetLatestHelmPackagePath?api-version=2019-11-01-preview&releaseTrain=${ReleaseTrain}"

$AzLocation = Get-AzLocation | Where-Object { ($_.DisplayName -ieq $Location) -or ($_.Location -ieq $Location)}
$Region = $AzLocation.Location
if ($null -eq $Region) {
Write-Error "Invalid location: $Location"
return
}

$ChartLocationUrl = "https://${Region}.dp.kubernetesconfiguration.azure.com/azure-arc-k8sagents/GetLatestHelmPackagePath?api-version=2019-11-01-preview&releaseTrain=${ReleaseTrain}"

$Uri = [System.Uri]::New($ChartLocationUrl)
$Account = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile.DefaultContext.Account
Expand Down

0 comments on commit c893de7

Please sign in to comment.