Azure Functions Powershell: module could not be loaded via managed dependencies - azure

We are having trouble importing a library form powershellgallery.com: IntuneWin32App.
The error msg goes as follows:
"ERROR: The 'New-IntuneWin32AppPackage' command was found in the module 'IntuneWin32App', but the module could not be loaded."
We are running Azure functions 3, Powershell 7.1.
IntuneWin32App is imported via managed dependencies. Specified in the "requirements.psd1" as follows:
'IntuneWin32App' = '1.*'
We have tried several solutions for related issues to this error but none could help us.
EDIT: detailed output: https://pastebin.com/t3kBF00A
We also did a deployment of the function to the cloud environment and we are retrieving the same issue over there.

[2021-07-30T06:54:54.792Z] ERROR: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
Does the module require authentication? It seems it's trying to launch a winforms window which isn't available in PowerShell 7.
Is there another authentication mechanism you can use with that module like service principal or certificate that prevents the window?

Related

Azure Function err: microsoft.Azure.WebJobs.Extensions.Http

I just had the same 'TestTrigger' can't be invoked from Azure WebJobs SDK. Is it missing Azure WebJobs SDK attributes?"-error in a v4 function running .Net 6.0.
error :
"System.Private.CoreLib: Could not load file or assembly 'Microsoft.Azure.WebJobs.Extensions.Http, Version=3.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified."
enter image description here
It think this issue is misleading.
I changed TargetFramework from netcoreapp3.1 to net6.0 and this issue started to appearing.
I was looking for solutions in the web, without any success. In the end I created new Azure Function and copy code step by step.
It occurred that for my case I needed to
remove dependencies
add _FunctionsSkipCleanOutput property
In the screenshot below please focus on Microsoft.Extension part.

Azure AD: I need to change a Company wide setting, but apparently that's impossible?

I need to change a setting in Azure to allow for Email Verification. MS documentation states that I have to get into azure's powershell and run Set-MsolCompanySettings -AllowEmailVerifiedUsers. I found this, however, to be apparently impossible?
In order to do this, I have to use before: Connect-MsolService, which gives me this error:
Connect-MsolService: Could not load file or assembly
'System.IdentityModel, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'. The system cannot find the file
specified.
And from what I read, Azure's Powershell does not allow for this?? How am I supposed to run that command?
Thanks in advance, any clue is welcome at this point
We have did a repro in our local environment, below statements are based on the repro analysis.
I have tried connecting to msolservice & successfully enabled the company setting " AllowEmailVerifiedUsers" in my local machine that is running with PowerShell version 5.1
Set-MsolCompanySettings -AllowEmailVerifiedUsers $true
Here is the output
I have tried running the same company setting cmdlet in PowerShell core version 7 it is failing with same error that you have mentioned above.
Based on this GitHub , we understood that currently MSOnline module version v1 is too old and it is not supported in PowerShell core 7.
We would suggest you use the PowerShell version 5.1 to enable company setting using MsolOnline module.

API deployed in Azure that doesn't work and i dont know why

PS: Found solution see below
i deployed my API to azure via bitbucket pipleine using FTP, but whehn i open the link of the API it displays "HTTP Error 500.30 - ASP.NET Core app failed to start"
Also when i make a request over postman or the frontend SPA it gives me ther same error.
Im realy lost within azure, becouse so many menus and i cant understand whats the problem. It works fine locally and the pipeline was sucessfully.
Can someone help me understand whats going on?
PS: after some diagnostic ( its menu is not intuitive at all) i found this:
: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified. File name: 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
My instaled verson is 12.0.0.3 and version 12.0.0.0 dosent even exist on nuget packet manager. Any ideas?
PS: FOUND A SOLUTION
my pipeline is:
https://ibb.co/xC1tcFp
Before the solution the line " cp ./AzureFix/Newtonsoft.Json.dll ./publish" didnt existed and the problem was that the file "Newtonsoft.Json.dll" that bitbucket generated inside the "publish" folder was invalid and when i did "dotnet publish --output publish --configuration release" in my pc that same file was valid.
I found that by using an FTP software to transfer my local files of the "publish" folder to azure and it worked.
So i created a folder in the bitbucket repository with the valid file inside it and in the pipeline i added a line that copy that file to the "publish" folder generated by bitbucket folder and it works like a charm.
Why did that happen ( the generated file of the bitbucket "publish" was invalid) ?
500.30 errors are startup problems, and can stem from a lot of different things, so giving an exact answer is tough. Check your Startup.cs and Program.cs to ensure everything is correct. This could be various dependencies such as DB stuff, cache, KeyVault, etc. or issues with ASP.Net versions.
If you have App Insights running for this App Service, check to see if it reports any issues. Or turn on application logging (https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs).
You can also use Kudo to do advanced debugging: https://zimmergren.net/solving-asp-net-core-3-on-azure-app-service-causing-500-30-in-process-startup-failure/
Please check if all the NuGet packages are updated -
I struggled with this error for four days and tried every possible suggestion on forum.
And finally after updating all NuGet packages the problem was resolved.

Trying to create an Azure logic app connection but I got error

I'm trying to create a work, recieve a message from SAP.
I build a VM and install latist SAP NCo (SAP Connector for Microsoft .NET 3.0.23.0 for Windows 64bit (x64), May 28, 2020), SAP Logon 760 and on-permises data gateways.
when I trying to create the connection, I got a error report here:
Please check your account info and/or permissions and try again. Details: Failed to process request. Error details: 'Could not load file or assembly 'sapnco, Version=3.0.0.42, Culture=neutral, PublicKeyToken=50436dca5c7f7d23' or one of its dependencies. The system cannot find the file specified.
What should I do? Thanks!
enter image description here
According to the error message, it seems the assembly files might be in the wrong location. So please check and make sure that you copied the assembly files to the data gateway installation folder. You can refer to this tutorial.

Azure: Could not load file or assembly 'Microsoft.ServiceBus

I have a app fabric service that I want to test. (http://xxx.cloudapp.net:8081/service.svc).
I created a console app and added a service reference to the service and got the following error:
Could not load file or assembly
'Microsoft.ServiceBus,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system
cannot find the file specified.
I added a reference to Microsoft.ServiceBus from C:\Program Files (x86)\Windows Azure platform AppFabric SDK\V1.0\Assemblies\NET4.0
I set all assemblies in my project to Copy Local = True, as suggested here:
http://msdn.microsoft.com/en-us/library/ee706702.aspx
Additional Due diligence:
I opened Microsoft.ServiceBus in red-gate's reflector and confirmed that it is the correct version. Just for kicks, I also added references to each assembly referenced in reflector and set all references to copy local = true.
Any other ideas?
…Peter
Make sure you change the Target Framework (Project properties/Application tab) from '.NET Framework 4 Client Profile' to '.NET Framework 4'.
I found a similar post and that was what helped me.
I believe it has to with the fact that Microsoft.ServiceBus is not supported by the client profile of .NET 4.
When you reference Microsoft.ServiceBus.dll, reference it from the install location, e.g.,
C:\Program Files (x86)\Windows Azure
platform AppFabric
SDK\V1.0\Assemblies\NET4.0\Microsoft.ServiceBus.dll
... not from the GAC, and set Copy Local to true.
You need to do this in whatever you are deploying into Azure; the Microsoft.ServiceBus.dll needs to packaged with your project because it is not available by default in Azure.
If you fire up Fiddler, you see a 500 error when calling the service. This proves that the exception isn't in your calling application.
ServiceBus dll is not installed on Azure boxes
Make sure your reference to the assembly specifies COPY LOCAL
Also make sure you don’t have references to the service bus dll in upper projects which do NOT copy local (this might be your problem if you have verified 1 above)
You can check the CSX tree for your azure build folder to see if the assembly is being copied into the final package. That’s a lot quicker than uploading to azure or starting the dev fabric.
That should solve your problem

Resources