Azure / Azure/azure-functions-powershell-worker

Az.Accounts 2.1.0 and 2.1.2 fail to load into PowerShell session for run-from-package apps

Open
#554 4 comments 7 reactions 0 assignees View on GitHub
announcement
Dominant language
C#
Stars
215
Forks
61
Avg merge
21h 4m
Merged PRs (30d)
6

Description

When a Functions app is deployed in the [run-from-package](https://docs.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package) mode, upgrading Az.Accounts to 2.1.0 or 2.1.2 may cause the app to fail with messages indicating that the Az.Accounts is not loaded, for example:

- `The term 'X' is not recognized as the name of a cmdlet, function, script file, or operable program.`, where `X` is the name of a command defined in the Az.Accounts module.
- `The Azure PowerShell context has not been properly initialized. Please import the module and try again.`

These error messages are somewhat misleading. The Az.Accounts module is properly installed, but it cannot be loaded because it tries to write to the `D:\home\site\wwwroot` directory, and this directory is mounted as read-only when the app is deployed in the run-from-package mode. Importing Az.Accounts explicitly (`Import-Module Az.Accounts`) exposes the root cause:

- `Could not find file 'D:\home\site\wwwroot\.IdentityService'. Exception :Type : System.IO.FileNotFoundExceptionMessage `

This is a regression in Az.Accounts 2.1.0 and 2.1.2

## Workaround

Until the Az.Accounts module is fixed, please pin your app to Az.Accounts **1.9.5** by using the instructions in the first post of #552.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.