Skip to content

Commit 5e7e926

Browse files
authored
fixed overrideparameter undefined issue (#20979)
1 parent 325bdf6 commit 5e7e926

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

Diff for: Tasks/AzureResourceManagerTemplateDeploymentV3/Strings/resources.resjson/en-US/resources.resjson

+2-1
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,6 @@
101101
"loc.messages.AuthSchemeNotSupported": "Auth Scheme %s is not supported",
102102
"loc.messages.ErrorInSettingUpSubscription": "Error in setting up subscription: %s",
103103
"loc.messages.BicepParamBuildFailed": "\"az bicep build-param\" failed. Error: %s",
104-
"loc.messages.IncompatibleAzureCLIVersionBicepParam": "Azure CLI version should be >= 2.47.0 to use .bicepparam file"
104+
"loc.messages.IncompatibleAzureCLIVersionBicepParam": "Azure CLI version should be >= 2.47.0 to use .bicepparam file",
105+
"loc.messages.ErrorWhileOverrideParameterUndefined": "The provided metadata file '%s' is missing metadata of parameter '%s'"
105106
}

Diff for: Tasks/AzureResourceManagerTemplateDeploymentV3/operations/Utils.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,12 @@ class Utils {
369369
}
370370

371371
try {
372-
overrideParameter.value = this.castToType(overrideParameter.value, template.parameters[overrideParameter.name].type);
372+
if (template.parameters[overrideParameter.name] === undefined) {
373+
tl.error(tl.loc("ErrorWhileOverrideParameterUndefined", taskParameters.csmFile, overrideParameter.name));
374+
}
375+
else {
376+
overrideParameter.value = this.castToType(overrideParameter.value, template.parameters[overrideParameter.name].type);
377+
}
373378
} catch (error) {
374379
console.log(tl.loc("ErrorWhileParsingParameter", overrideParameter.name, error.toString()));
375380
}

Diff for: Tasks/AzureResourceManagerTemplateDeploymentV3/task.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"author": "Microsoft Corporation",
1515
"version": {
1616
"Major": 3,
17-
"Minor": 254,
17+
"Minor": 255,
1818
"Patch": 0
1919
},
2020
"demands": [],
@@ -341,6 +341,7 @@
341341
"AuthSchemeNotSupported": "Auth Scheme %s is not supported",
342342
"ErrorInSettingUpSubscription": "Error in setting up subscription: %s",
343343
"BicepParamBuildFailed": "\"az bicep build-param\" failed. Error: %s",
344-
"IncompatibleAzureCLIVersionBicepParam": "Azure CLI version should be >= 2.47.0 to use .bicepparam file"
344+
"IncompatibleAzureCLIVersionBicepParam": "Azure CLI version should be >= 2.47.0 to use .bicepparam file",
345+
"ErrorWhileOverrideParameterUndefined": "The provided metadata file '%s' is missing metadata of parameter '%s'"
345346
}
346347
}

Diff for: Tasks/AzureResourceManagerTemplateDeploymentV3/task.loc.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"author": "Microsoft Corporation",
1515
"version": {
1616
"Major": 3,
17-
"Minor": 254,
17+
"Minor": 255,
1818
"Patch": 0
1919
},
2020
"demands": [],
@@ -341,6 +341,7 @@
341341
"AuthSchemeNotSupported": "ms-resource:loc.messages.AuthSchemeNotSupported",
342342
"ErrorInSettingUpSubscription": "ms-resource:loc.messages.ErrorInSettingUpSubscription",
343343
"BicepParamBuildFailed": "ms-resource:loc.messages.BicepParamBuildFailed",
344-
"IncompatibleAzureCLIVersionBicepParam": "ms-resource:loc.messages.IncompatibleAzureCLIVersionBicepParam"
344+
"IncompatibleAzureCLIVersionBicepParam": "ms-resource:loc.messages.IncompatibleAzureCLIVersionBicepParam",
345+
"ErrorWhileOverrideParameterUndefined": "ms-resource:loc.messages.ErrorWhileOverrideParameterUndefined"
345346
}
346347
}

0 commit comments

Comments
 (0)