MSAL.PS icon indicating copy to clipboard operation
MSAL.PS copied to clipboard

How to load in Azure Function App, and "same name" error still occurs in 4.16.0.4

Open Markarend opened this issue 3 years ago • 1 comments

Can you show how to load a specific, required version of MSAL.PS to an Azure Function App? Methods tried:

  1. In requirements.psd1, add the line: 'MSAL.PS' = '4.5.1.1' telling Azure to load this as a managed dependency. This works but has another problem: Azure will only load managed dependencies that don't require license acceptance, so 4.5.1.1 is the last such version that can be loaded this way. I need fixes that were added after 4.5.1.1.

  2. Or, in the script, add lines:
    Install-Module -Name 'MSAL.PS' -RequiredVersion '4.16.0.4' -AcceptLicense -Force Import-Module -Name 'MSAL.PS' -RequiredVersion '4.16.0.4'

    First run: 2020-11-04T17:21:10.208 [Information] INFORMATION: Install-Module MSAL.PS -RequiredVersion 4.16.0.4 -AcceptLicense -Force 2020-11-04T17:21:33.952 [Warning] WARNING: User declined to install module (MSAL.PS). Why would "user declined" occur if I used -AcceptLicense?

    Second run: System.IO.FileLoadExceptionMessage : Assembly with same name is already loaded ... Import-ModuleCommandOrigin : InternalScriptStackTrace : at <ScriptBlock>, D:\local\UserProfile\Documents\PowerShell\Modules\MSAL.PS\4.16.0.4\MSAL.PS.ps1: line 20 at <ScriptBlock>, D:\local\UserProfile\Documents\PowerShell\Modules\MSAL.PS\4.16.0.4\MSAL.PS.psm1: line 17 This "already loaded" error is supposed to be fixed in 4.16.0.4, however, in this version, line 20 has had no fix applied: Add-Type -LiteralPath $RequiredAssemblies | Out-Null

There must be a way to load a version to an Azure Function App that requires license acceptance, do you know it?

Thanks, Mark Arend

Markarend avatar Nov 04 '20 20:11 Markarend