Azure / Azure/azure-quickstart-templates

Custom Script VM extension does not work as expected

Open
#4,477 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

### Issue Details

I was recently sought a need to use Powershell script custom VM extension to perform a series of tasks like installation of NodeJS etc. In the same script I have a few steps for creation of a scheduled task which would run on startup. If I run the script standalone, it works fine. However, as an extension, majority of tasks pass but creation of task fails. I am using the below command to create a task.

```
$startupTrigger = New-JobTrigger -AtStartup -RandomDelay 00:00:30
Register-ScheduledJob -Trigger $startupTrigger -FilePath C:\gpsServer\GPSServer\serverStart.ps1 -Name StartHttpServer
```
Also, I am unable to copy file in logged in user's startup folder.
Please let me know if I missing something.
Thanks in advance.
Surabh

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the Custom Script VM extension context and the two commands using New-JobTrigger and Register-ScheduledJob. Compare their behavior with the standalone script, including access to C:\gpsServer\GPSServer\serverStart.ps1 and the logged-in user's startup folder. Done means the scheduled task is created and the file is copied when the script runs as an extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.