Skip to content

Commit be4e8bf

Browse files
authored
fix 569 (#573)
1 parent 1fc9c76 commit be4e8bf

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

arm-ttk/testcases/deploymentTemplate/URIs-Should-Be-Properly-Constructed.test.ps1

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@ foreach ($found in $foundObjects) { # Walk over each found object
2222
foreach ($prop in $found.psobject.properties) { # then walk thru each property
2323
if ($prop.Name -notmatch 'ur[il]$') { continue } # skipping ones that are not uri/url
2424
if (-not $prop.value | ?<ARM_Template_Expression>) { continue } # and ones that do not contain an expression.
25-
26-
2725

2826
# If the value contained expressions, but not the function uri
2927
$foundBadFunction = $prop.Value | ?<ARM_Template_Function> -FunctionName ($FunctionNotAllowedInUri -join '|')
3028
$foundUriFunction = $prop.Value | ?<ARM_Template_Function> -FunctionName uri
29+
3130
if (
3231
($foundBadFunction -and -not $foundUriFunction) -or
33-
$foundBadFunction.Index -lt $foundUriFunction.Index
32+
($foundBadFunction.Index -lt $foundUriFunction.Index -and $foundBadFunction)
3433
) {
3534
Write-Error "Function'$($foundBadFunction.Groups['FunctionName'].Value)' found within '$($prop.Name)" -TargetObject $found -ErrorId "URI.Improperly.Constructed"
3635
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
{
2-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
3-
"outputs": {
4-
"ServerUrl": {
5-
"type": "string",
6-
"value": "[uri(concat('http://', reference(variables('publicIPAddressName')).dnsSettings.fqdn), 'somepath')]"
7-
}
2+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"resources": [],
5+
"outputs": {
6+
"ServerUrl": {
7+
"type": "string",
8+
"value": "[uri(concat('http://', reference(variables('publicIPAddressName')).dnsSettings.fqdn), 'somepath')]"
9+
},
10+
"otherUri": {
11+
"type": "string",
12+
"value": "[uri(reference(resourceId('Microsoft.KeyVault/vaults/keys', 'keyVaultName', 'keyName'), '2021-06-01-preview').keyUri, 'blah')]"
813
}
14+
}
915
}

0 commit comments

Comments
 (0)