ARM Template not calling Powershell script

Hi Thwackers!

I have an issue with the latest version of ARM

After creating a template using Paul's excellent tool the template doesn't call the Powershell script that is setup

This was setup by one of Solarwinds partners, and we have both been through it and everything looks ok

Just after pointers on where to go next or any suggestions you good people may have

Thanks in advance

James

  • Hi James,

    I guess you would like to use the "scriptOptions" in your template?

    Could you share what parameters you pass to your script and how you load these parameters into your script? I often experienced troubles with the different scripting options (modern vs. legacy scripting) and may help you based on your answer.

    Kind regards,

    Emanuel

  • Thank you Emanuel,

    We are using this to 'join up' the parameters from the template to the Powershell script

  • OK, I see. is it an OpenTemplate we are talking about?

  • Update on issue:

    I have fixed the issue of it not calling the script from the open.template, it was the name of the script not matching

    Now I have another issue, the script is called and runs, but there is a permissions issue, the script runs ok in Powershell when launched as the ARM Service account

    Here is the error from the logs when the template/script is ran

    powershell.exe -executionpolicy bypass -inputformat none -File C:\ProgramData\protected-networks.com\8MAN\scripts\analyze\NewProjectsFolder.ps1 -ServerName SERVER1 -RootFolderPath "Test Group"
    New-ADGroup : Access is denied
    At C:\ProgramData\protected-networks.com\8MAN\scripts\analyze\NewProjectsFolder.ps1:139 char:5
    + New-ADGroup -Name $ADBaseGroupName -SamAccountName $ADBaseGroupNa ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : PermissionDenied: (CN=Test Group - A...DC=tes,DC=local:String) [New-ADGroup], Unauthorized
    AccessException
    + FullyQualifiedErrorId : ActiveDirectoryCmdlet:System.UnauthorizedAccessException,Microsoft.ActiveDirectory.Manag
    ement.Commands.NewADGroup

    I have edited out a couple of company specific items, Test Group replaces them in the above output for security reasons

    Any thoughts would be appreciated

    Thank you

  • Hi Everyone, the permissions issue for the main script fixed itself !, the only issue remaining in the script is the first Access is Denied, any ideas?, thank you

    powershell.exe -executionpolicy bypass -inputformat none -File C:\ProgramData\protected-networks.com\8MAN\scripts\analyze\NewProjectsFolder.ps1 -ServerName SERVER1 -RootFolderPath "Test Group"
    New-ADGroup : Access is denied
    At C:\ProgramData\protected-networks.com\8MAN\scripts\analyze\NewProjectsFolder.ps1:139 char:5
    + New-ADGroup -Name $ADBaseGroupName -SamAccountName $ADBaseGroupNa ...

  • Hi James, 

    have you configured an account in the Credentials property in the script config? The labeling in that section is misleading (it says if you dont put in an account it will use the AD service account but that is not true, it will actually use SYSTEM which could explain your issue).