Hi Siegried, It looks like you are facing an issue with loading the System.IdentityModel.Tokens.Jwt
assembly in your compiled C# Azure Function. This error occurs when the required assembly is not found or cannot be loaded by the function.
To resolve this issue, please try to do the following steps if possible:
Ensure that the System.IdentityModel.Tokens.Jwt
assembly is referenced in your project. You can do this by right-clicking on your project in Visual Studio, selecting "Manage NuGet Packages," and searching for the System.IdentityModel.Tokens.Jwt
package. If it is not listed, install it.
Check the properties of the System.IdentityModel.Tokens.Jwt
assembly reference in your project. Set the "Copy Local" property to true
. This ensures that the assembly is copied to the output directory when building the project.
If you have multiple projects in your solution, make sure that all the projects targeting the Azure Function have the System.IdentityModel.Tokens.Jwt
assembly referenced and set to "Copy Local" as mentioned in step 2.
Clean and rebuild your solution to ensure that the assembly is copied to the output directory.
Ensure that you have the appropriate version of the System.IdentityModel.Tokens.Jwt
assembly referenced in your project. Check the version specified in your error message (Version=6.29.0.0
) and verify if you have that specific version installed. If not, try installing the required version or update the code to use a compatible version of the assembly.
If the issue persists, try removing and re-adding the System.IdentityModel.Tokens.Jwt
assembly reference. You can remove it from the project, clean the solution, and then add it again.
Verify that the required assembly is deployed to the Azure Function App. You can check the "Dependencies" section in the Azure portal for your Function App and ensure that System.IdentityModel.Tokens.Jwt
is listed as a dependency. If it is not listed, try redeploying your Azure Function from Visual Studio to ensure the correct deployment.
After you followed these steps you should be able to resolve the assembly loading issue and successfully authenticate and authorize your Azure Function using Azure AD B2C.
I hope this helps? Please let me know if you have any other queries?