I have a function app that has a queue trigger to run an Invoke-AzRunCommand on an Azure VM that was working just fine a couple of weeks ago. It is not used that often but when trying today, I'm seeing the following in my logs: "The Function app may be missing a module containing the 'Disable-AzContextAutosave' command definition."
Per a thread I found searching for the error - I added the following 'Az.Accounts' to the requirements.psd1 file like so - I have no idea about versioning:
@{
# For latest supported version, go to 'https://www.powershellgallery.com/packages/Az'.
# To use the Az module in your function app, please uncomment the line below.
'Az' = '9.*'
'Az.Accounts' = '2.*'
}
I did get this to work when running from 'Code + Test' but when trying to run via web app - it fails with the above error.
I didn't even know where it was being called and then found it in the profiles.ps1 file. I'm assuming this is needed since I'm using the System Assigned identity:
if ($env:MSI_SECRET) {
Disable-AzContextAutosave -Scope Process | Out-Null
Connect-AzAccount -Identity
}
How do I get passed this error?
In the Configuration the Runtime Version is ~4 with no other options in the drop-down:
