Loading...

Dataverse : Azure Functions .Net Framework vs .Net Core / Runtime 1 vs 4 - Migration Steps

Dataverse : Azure Functions .Net Framework vs .Net Core / Runtime 1 vs 4 - Migration Steps
Dataverse : Azure Functions .Net Framework vs .Net Core / Runtime 1 vs 4 - Migration Steps Lloyd Sebag Tue, 10/25/2022 - 16:48
Body

Dataverse : Azure Functions .Net Framework vs .Net Core / Runtime 1 vs 4 - Migration Steps:

Do you have a FunctionApp in Runtime 1 targeting a .Net Framework project and want to migrate it to a newer Runtime like 4?

This is possible! But not so simple if you don't read this article! ;)

Azure Function Runtim 4 and .Net Framework?

First of all, we must clarify a gray area introduced by Microsoft. In the official Azure Function Runtime documentation, there is a table suggesting that Runtime 4 is natively compatible with the .Net Framework. It's partially true...

Dataverse : Azure Functions .Net Framework vs .Net Core / Runtime 1 vs 4 - Migration Steps

In fact it seems possible but through the option to run the App in isolated process.
Here is the doc.

I have been able to try to follow the steps to do so, without success at the time of writing this article. Indeed, my version of Visual Studio doesn't seem to handle this correctly...
Here's a GitHub thread speaking about it.

So how to do?

The King is Dead, Long Live the King!

For years we have all used the Dynamics NuGet package allowing us to connect to the service and use the API. Microsoft.CrmSdk.XrmTooling.CoreAssembly

Except that this great package is only available from version 4.6.2 of the .Net Framework!

Until recently, there was no solution to use these DLLs with .Net Core...Then the Microsoft.PowerPlatform.Dataverse.Client project appeared. It's been in preview for a while, but it's now been in GA since June 2022!

This package will not only allow you to retrieve your development habits but will also offer you new methods and others to come.

Here is a sample code allowing you to connect to Dataverse and do a WhoAmI. You will notice that the code is not changing a lot between the old version CrmServiceClient and the new ServiceClient!

var service = new ServiceClient($@"AuthType=ClientSecret;url=URL;ClientId=ID;ClientSecret=SECRET");
var userId = (WhoAmIResponse)service .Execute(new WhoAmIRequest());
log.LogTrace("UserId : " + userId.UserId);

Ready for Azure Runtime 4!

Thanks to this, you can now fully consider migrating your FunctionApps from runtime 1 to 4 and thus be up to date in your PaaS.

You will obviously have to consider skipping the following points:

  • Change the Runtime on Azure Function. 
  • Modify your VS project to point to the correct framework and runtime version.
  • Modify your NuGet packages to remove the old and reference the new.
  • Modify the code to resolve the errors.
  • And more... 

Step by Step

1. Change the Runtime on Azure Function. 

  • Log in to your Azure Portal and navigate to your Function App.
  • Go to the Configuration section and then to the Function Runtime Settings tab.
  • Here you will have a drop-down list to choose the Runtime version.

Dataverse : Azure Functions .Net Framework vs .Net Core / Runtime 1 vs 4 - Migration Steps

  • If ever you cannot select version 4. Here is a procedure allowing you to carry out the modification by CLI script.
az login
az functionapp config set --net-framework-version v6.0 -g  -n 
az functionapp config appsettings set --settings FUNCTIONS_EXTENSION_VERSION=~4 -g  -n 

2. Modify your VS project to point to the correct framework and runtime version

  • Open your Visual Studio project and open the .csproj file.
  • Modify these two nodes as follows.

Dataverse : Migrate Azure Functions from .Net Framework (Runtime 1) to .Net Core (Runtime 4)

3. Other steps 

I think you know how to modify the NuGet packages and migrate your code. No trap here. :)

Enjoy ! 

Dataverse : Azure Functions .Net Framework vs .Net Core / Runtime 1 vs 4 - Migration Steps

Image
/sites/default/files/2022-10/chro.png

Published on:

Learn more
Featured Articles | Dynamics Chronicles
Featured Articles | Dynamics Chronicles

Welcome to our blog, the content is entirely dedicated to Microsoft Dynamics 365, CRM, Power Platform, Common Data Service (CDS) but also Azure. Follow us !

Share post:

Related posts

Announcing General Availability of UNISTR function and ANSI SQL || Operator in Azure SQL

We’re excited to announce the General Availability (GA) of two long-standing capabilities that address critical needs for SQL developers and e...

2 hours ago

Power BI Cognitive Services and Azure Machine Learning features retiring; transition to Fabric AI services

Power BI is retiring Cognitive Services and Azure Machine Learning features by September 15, 2025, transitioning AI capabilities to Microsoft ...

7 hours ago

Dynamics 365 Contact Center – Use Azure Communication Service-based SMS Mobile Numbers

How does this affect me? With this feature, Dynamics 365 Contact Center admins can now engage with customers in Australia, Belgium, Denmark, F...

7 hours ago

Microsoft Entra: Action Required – Update Conditional Access Policies for Azure DevOps Sign-ins

Microsoft Entra requires updating Conditional Access policies by September 4, 2025, to explicitly include Azure DevOps (App ID: 499b84ac-1321-...

7 hours ago

Microsoft 365 & Power Platform Call (Microsoft Speakers) – Community Takeover – July 29th, 2025 – Screenshot Summary

Call Highlights   SharePoint Quicklinks: Primary PnP Website: https://aka.ms/m365pnp Documentation & Guidance SharePoint Dev Videos Issues...

1 day ago

Power Platform – Assisted mapping for standard dataflows

We are announcing assisted mapping for standard dataflows in Power Platform. This feature will reach general availability on July 31, 2025. Ho...

1 day ago

Azure Developer CLI (azd) – July 2025

This post announces the July release of the Azure Developer CLI (`azd`). The post Azure Developer CLI (azd) – July 2025 appeared first o...

1 day ago

Why Environment Management Matters for Architects and Developers in Power Platform

Environment Management isn’t just an admin feature—it’s a strategic enabler for solution architects and developers building on Power Platform....

1 day ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy