Home > Software design >  Azure function app, Powershell 7.2 dll module install
Azure function app, Powershell 7.2 dll module install

Time:08-30

I have this powershell script which works very well on my computer. I use the x64 and powershell 7.2.

The problem is when I publish the code to Azure, there is a module missing. The module is a .net System.Data.OleDb.

 ERROR: Exception calling "Open" with "0" argument(s): "The 'MSOLAP' provider is not registered on the local machine."

I have tried to add the .dll file to Module folder, that i created but function app doesn't load it for some reason.

Structure of the function app

  • host.json
  • local.settings.json
  • powerbitablerefresh
    • run.ps1
    • function.json
  • Modules
    • Microsoft.AnalysisServices.AzureClient.dll
  • profile.ps1
  • requirements.psd1
    • inside requirements I have:
'Az.Keyvault' = '4.*'
'Az.Accounts' = '2.*'
'Az.AnalysisServices' = '1.*'
'SqlServer' = '21.1.18256'

My question is, how do I install .dll on a function app?

CodePudding user response:

how do I install .dll on a function app?

You can install .dll files by following below workaround:

  • Firstly, Login to Azure
  • Then open your Function App
  • Then Click on Advanced tools , then click on Go
  • Then Click on Tools, Then click on Zip Push Depoly like below:

enter image description here

  • Then Click on your function app
  • Then click on bin folder and after it opens, drag your .dll file over there and then you can reference them in your function app:

enter image description here

CodePudding user response:

The right answer is that add the .dll files to the C:\home\site\wwwroot\ and then in the powershell script run it like this

Add-Type -Path "Microsoft.Identity.Client.dll" 
Add-Type -Path "Microsoft.AnalysisServices.AdomdClient.dll" 

It will then create a connection

  • Related