web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Updating dataverse from time triggered Azure function

(0) ShareShare
ReportReport
Posted on by 794

Hello, 

I'm trying to update a record from Dataverse using an Azure function. 

My first step is to try to get the service/client, the variable that's used in any plugin to CRUD the Dataverse. 

My code is: 

public static void Run([TimerTrigger("0 0 0 * * *")]TimerInfo myTimer, ILogger log)
{
    var service = DataverseConnection();
}

private static ServiceClient DataverseConnection()
{
    var clientID = Environment.GetEnvironmentVariable("cdsclientid", EnvironmentVariableTarget.Process);
    var clientSecret = Environment.GetEnvironmentVariable("cdsclientsecret", EnvironmentVariableTarget.Process);
    var crmBaseUrl = Environment.GetEnvironmentVariable("cdsurl", EnvironmentVariableTarget.Process);
    var connectionString = @$"Url={crmBaseUrl};AuthType=ClientSecret;ClientId={clientID};ClientSecret={clientSecret};RequireNewInstance=true";
    var service = new ServiceClient(connectionString);
    return service;
}

I know the environment variables are correct because I can fetch data like in this guide  PL-400_Microsoft-Power-Platform-Developer (microsoftlearning.github.io)

The error I get is: 

pastedimage1660028430132v1.png

I'm using netcoreapp 3.1 and my dependencies are: 

pastedimage1660028517206v2.png

Thanks.

I have the same question (0)
  • Arcadi  Profile Picture
    794 on at
    RE: Updating dataverse from time triggered Azure function

    Just to add, after a lot of trial and error I was able to update a record with:

    pastedimage1660034630260v1.png

    Yet I wonder If I can use the same logic than with plugins (Service).

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 130

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 118 Super User 2025 Season 2

#3
Erin Lubben Profile Picture

Erin Lubben 57

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans