Skip to content
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

Error using assignment file with comments #71

Open
tiwilson7 opened this issue Oct 19, 2021 · 0 comments
Open

Error using assignment file with comments #71

tiwilson7 opened this issue Oct 19, 2021 · 0 comments

Comments

@tiwilson7
Copy link

Problem

We recently ran into an error when we added comments to our assignment files.

It seems that ConvertFrom-Json in older powershell versions do not support json with comments but newer versions do support it.

Broken: 5.1
Working: 7.1.5

Solution

This task is incredibly helpful! It would be great if the powershell version could be updated so that assignment would work with json with code comments. We have found adding comments is very helpful in maintaining the blueprint.

It seems like this could be a quick fix to task.json

Workaround

We are currently using this inline powershell script as a workaround.

Write-Host 'The Assign Azure Blueprint task uses an old version of powershell that does not support json with comments.' 

Write-Host "Removing comments from $(blueprintAssignmentPath)"

# https://stackoverflow.com/questions/51066978/convert-to-json-with-comments-from-powershell/51069060#51069060
(Get-Content '$(blueprintAssignmentPath)')  -replace '^\s*//.*' | Out-File '$(blueprintAssignmentPath)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant