-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
securestring broken in Test-AzResourceGroupDeployment/New-AzResourceGroupDeployment #12792
Comments
I ran into the same problem with our ARM deployments from Azure DevOps using Microsoft hosted agents (VS-2017). Currently, I worked around the problem by forcing a specific version of the Az module. https://www.powershellgallery.com/packages/Az/4.5.0
|
Hi @DOMZE we have acknowledged this issue. Fix will be available in the next release. Thanks for reporting! |
This definetly resolves the issue as suggested by @krishjag |
Is this fixed in 4.6.1? |
No, sorry, 4.6.1 fixed an issue in Az.Compute. |
Was this closed in favor of #12819? |
Having the same issue trying to deploy an ARM template with "New-AzResourceGroupDeployment" in Azure Automation Runbooks. |
Thanks for sharing your findings. Spent 4 hours debugging my script and template until I found this post. |
@ckiefer we are targeting next Tuesday, 9/22 |
I am also facing this issue while using securestring to be passed in New-AzResourceGroupDeployment using powershell in AzureDevOps release pipeline using VS2017-win2016 agent but not with windows-2019 agent. |
Hi @pravin-g-otk this issue is fixed in Az 4.7.0 / Az.Resources 2.5.1 (just released). Could you please try and verify? |
omg, lost half a day to find out why the deployment using azure pipelines stopped working. Please update the hosted pipeline images! |
@isra-fel This still doesn't seem to work when using the The only way we got it to work using the
We have no idea why Anyway, if you don't do that workaround, the only way we found that worked (using just
like the OP. Or, equivalently, by splatting the parameters:
So I think there's still the same bug when applying template parameters through the |
I can confirm the problem still appears when using Az.Resources 6.6.0 (we haven't been able to upgrade to newer due to #21647). However, I found a slightly terser workaround: $sasToken = (ConvertTo-SecureString -AsPlainText -Force $StagingSasToken)
$templateParams["_artifactsLocationSasToken"] = $sasToken.PSObject.BaseObject
I think this is caused by the fact that many/most objects in PowerShell are automatically wrapped in |
Description
When passing a secure string to either Test-AzResourceGroupDeployment or New-AzResourceGroupDeployment the cmdlet returns
InvalidTemplate - Deployment template validation failed: 'Template parameter JToken type is not valid. Expected
'String, Uri'. Actual 'Object'. Please see https://aka.ms/resource-manager-parameter-files for usage details.'.
Occurs in 2.5.0
Doesn't occur in 2.4.0
Steps to reproduce
Arm template:
Environment data
Module versions
2.5.0 is problematic. Uninstalling 2.5.0 and installing 2.4.0 doesn't generate the error
Error output
The text was updated successfully, but these errors were encountered: