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

Loganalytics primary key was hashed to string which included ambersand (&) #4

Open
nithilin1 opened this issue Sep 26, 2023 · 1 comment

Comments

@nithilin1
Copy link

nithilin1 commented Sep 26, 2023

My log analytics primary key was hashed correctly in the scripting, but the hashed string included &. This caused the script to fail as the & symbol is protected.

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'c:\ADOAgent_work_temp\c3b03806-9538-471e-b928-bcbd70e48fc7.ps1'"
At C:\ADOAgent_work_temp\c3b03806-9538-471e-b928-bcbd70e48fc7.ps1:4 char:285

  • ... 55-4020-bf82-8fa3c12c28f4 -SharedKey rz3tpbr7Pz3AWKi5z8xkV3A&oLC2x&nN ... ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
    quotation marks ("&") to pass it as part of a string.
    At C:\ADOAgent_work_temp\c3b03806-9538-471e-b928-bcbd70e48fc7.ps1:4 char:291
  • ... 0-bf82-8fa3c12c28f4 -SharedKey rz3tpbr7Pz3AWKi5z8xkV3A&oLC2x&nNtF%PFa ... ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
    quotation marks ("&") to pass it as part of a string.
    • CategoryInfo : ParserError: (:) [], ParseException
    • FullyQualifiedErrorId : AmpersandNotAllowed

(Yes, this is the hashed and old version of the key.)

I was able to solve this by using my Loganalytics secondary key. I was however unable to detect where exactly to input the needed wraps for the & symbol to avoid this problem in the future.

@NickolajA
Copy link
Member

Wow that's a tough one. I don't know if this works, but give this a try:

filePath: 'Scripts/New-Win32App.ps1' arguments: -TenantID $(TenantID) -ClientID $(ClientID) -ClientSecret $(SP-IntuneAppFactory-ClientSecret) -WorkspaceID $(ReportWorkspaceID) -SharedKey """$(LA-IntuneAppFactory-PrimaryKey)"""

or;

filePath: 'Scripts/New-Win32App.ps1' arguments: -TenantID $(TenantID) -ClientID $(ClientID) -ClientSecret $(SP-IntuneAppFactory-ClientSecret) -WorkspaceID $(ReportWorkspaceID) -SharedKey "$(LA-IntuneAppFactory-PrimaryKey)"

This is a wild guess, it's probably not going to work.

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

2 participants