I am using a custom script extension for VM in ARM Template:
         {
   "type": "Microsoft.Compute/virtualMachines/extensions",
 "name": "[concat(parameters('vm-Name'),'-0',copyIndex(1),'/script')]",
   "apiVersion": "2015-05-01-preview",
   "location": "[resourceGroup().location]",
      "copy": {
                "name": "storagepoolloop",
                "count": "[parameters('virtualMachineCount')]"
            },
   "dependsOn": [
       "virtualMachineLoop",
       "nicLoop"
   ],
   "properties": {
       "publisher": "Microsoft.Compute",
       "type": "CustomScriptExtension",
       "typeHandlerVersion": "1.4",
       "settings": {
           "fileUris": [
       ],
      "commandToExecute": "[parameters('commandToExecute')]"
     }
   }
 }
where parameters = "powershell.exe $(Agent.TempDirectory)/$(script.secureFilePath)"
I am using azure devops secure files to store my script. I have Download a secure file task before deploying the vm. I have also tried directly referencing script file name "powershell.exe $(Agent.TempDirectory)/puscript.ps1"
I am using classic Release pipeline, if this is not the right way please guide how to use powershell script stored in secure files.
Any help is appreciated. Thanks in advance.



