Skip to content

Commit d547257

Browse files
367 Improving newguid secure parameters (#549)
* Improving support for NewGuid in SecureString parameters (Fixing #367) * Adding positive test for concat(NewGuid()) in SecureString parameters (Fixing #367)
1 parent 26c7359 commit d547257

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

arm-ttk/testcases/deploymentTemplate/Secure-String-Parameters-Cannot-Have-Default.test.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ foreach ($parameterProp in $templateObject.parameters.psobject.properties) {
3232
if ($parameter.Type -eq 'securestring' -and $parameter.defaultValue) {
3333
# the defaultValue must be an empty string "" or must be an expression that contains use the newGuid() function
3434
if ($parameter.defaultValue -and
35-
$parameter.defaultValue -notmatch $usedNewGuid) {
35+
-not ($parameter.defaultValue | ?<ARM_Template_Function> -FunctionName 'newguid')) {
3636
# Will return true when defaultvalue is not null or blank (blank values are OK).
3737
Write-Error -Message "Parameter $name is a SecureString and must not have a default value unless it is an expression that contains the newGuid() function." `
3838
-ErrorId SecureString.Must.Not.Have.Default -TargetObject $parameter
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
3+
"parameters": {
4+
"SecureStringParameter": {
5+
"defaultValue": "[concat(newGuid(), 'hello')]",
6+
"type": "SecureString"
7+
}
8+
}
9+
}
10+

0 commit comments

Comments
 (0)