# Start-Job with Azure resources

**URL:** <https://forums.powershell.org/t/start-job-with-azure-resources/8653>\
**Category:** PowerShell Help\
**Created:** [May 18, 2017, 9:08am UTC](https://forums.powershell.org/t/start-job-with-azure-resources/8653 "2017-05-18T09:08:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![magicmarty](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/magicmarty/32/458_2.png) [@magicmarty](https://forums.powershell.org/u/magicmarty)\
**Post date:** [May 18, 2017, 9:08am UTC](https://forums.powershell.org/t/start-job-with-azure-resources/8653/1 "2017-05-18T09:08:19Z")

</div>

Hey,

Did anyone has a chance to work with PShell background jobs with Azure resources?

I am trying to initiate custom script extension on the VMs with Start-Job function. It doesnt give me error message, but it finishes in few seconds. If I do without start-job, everything is running fine.

The code line I am having problem:  
Start-Job -ScriptBlock {RemoveCustomExt $VM.Name $Resource $VM.Location} -Name $VM.Name

RemoveCustomExt is a function and Start-Job is in ForEach loop.

Any help is much appreciated.

Thanks,  
Marty

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [May 22, 2017, 6:02am UTC](https://forums.powershell.org/t/start-job-with-azure-resources/8653/2 "2017-05-22T06:02:06Z")

</div>

Jobs runs under, essentially, a new PowerShell thread. I wonder if it’s having some problems with context - perhaps authentication, perhaps actually finding the function?

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:38pm UTC](https://forums.powershell.org/t/start-job-with-azure-resources/8653/3 "2024-05-16T20:38:44Z")

</div>


