Starting with a simple Hello “World” Azure Functions


Hi,

In this post we’d have a quick look at the Azure Functions

Azure Functions can be simply defined as – Code and Event. Basically, we’d have an event on which our code will execute. We can create a function pipeline wherein one function acts as a trigger to another function which then triggers the next action passing the corresponding output.

Azure Functions are easy to write, we can write them inside our Azure Portal or can write in them using command line tooling or Visual studio and easily upload them.

They can be easily bind to existing services like SendGrid, OneDrive, DropBox etc.

And the most important aspect is the Pay only for what you use. Azure Functions comes with monthly free grant of 1 million requests and 400,000 GB-s of resource consumption per month.

The easiest way to try our Azure Functions is to go to Azure Functions Portal

https://functions.azure.com/

Click on Try It For Free (this doesn’t require setting up Azure Trial or using our existing Azure Subscription).

However, this trial is just for 1 hour.

We’d select Web Hook + API as our scenario and C# as our language and click on create this function.

It will ask as us to choose an auth provider.

After successful authentication, we are presented with the function editor page

We have the function with the below sample code already configure for us. It basically looks for name parameter in either as query parameter or request body and append Hello to it as response.

Click on Run to test it.

Below we have passed Nishant Rana as the value for the query parameter name.

Clicking on the Get Function URL provides us with the url of this particular Funtion.

We can test it in browser or can use any of the extensions like Postman, Advanced Rest Client etc.

View files shows us all the files

Clicking in Integrate presents us with the option to configure the trigger for the function as well as option to define output for it

We can update our Azure Function to update only the Post request as show below.

We can define an output for this function by clicking on New Output.

As we are using free account we’d see many of the options disabled.

Manage section shows us the Key associated for this function.

It is the same key that is being used in the function url

To add a new function we can click the plus button.

Below are the different Function Template that are available.

Again, we have most of the options disabled as we are using free account.

As a next step, we’d create a free Azure account and create function that does something more meaningful.

Meanwhile –

Hope it helps..

Advertisements

{No Code Approach} Generic framework to delete all child records when a parent record is deleted in Dynamics 365 using Microsoft Flows


Interesting implementation using Microsoft Flow

Debajit's Dynamic CRM Blog

Here comes another requirement and here comes Microsoft flows again to bail me out. So let’s see what the requirement was and let’s see how can we implement Microsoft flows to achieve these easily which otherwise would have required extensive coding to achieve.

So it goes like this. Basically, there are lot of custom entities in the environment and there are many parent-child relationships in between those entities and they are referential in nature. Ideally parental would have suited for some, however due to the number of parental relationship limitation in Dynamics, they would set it up as referential.

Now whenever a parent record is deleted, the associated child records would be deleted as well. Since this is referential relationship, whenever we delete a parent record, the child records are left orphaned in the system.

Microsoft flows offers you an easy way to delete records in bulk. You could easily…

View original post 1,002 more words

Literal Improvement in C# 7.0


C# 7.0 now allows using underscore _ to be used a digit separator.

This adds more readability.

Similarly, we now have Binary Literals, so instead of specifying hexadecimal pattern we can specify bit patterns.

Hope it helps..

Using Out Variables (C# 7.0) instead of Out Parameters


Out Parameters must need to declared before they are used in the method which doesn’t seem intuitive.

Now with C# 7.0 we can now make use of Out variable.

Here in our second call to the method we have used out variable named outVariableString which we didn’t have to declare like output parameter.

Hope it helps..

Tuple Types and Tuple Literals in C# 7.0


Tuple are used when we need to get more than one value returned from the method.

C# 7.0 introduces Tuple Types and Tuple Literals to Tuples

We need to add System.ValueType Nuget Package to add the required assemblies to Visual Studio.

Below sample code shows usage of Tuple type and literal. In our second method, we have named the part of the tuple i.e. name and number.

Now to access the first method we use Item1 and Item2 field, however for our second method as we have named the part we can use those names to access them i.e. name and number.

Output in both the case

Hope it helps..

New Feature – Local Functions in C# 7.0


C# 7.0 adds a new feature called local functions.

Local functions allow us to define function within a function. It can be used to write helper methods that we need to use inside that function’s scope.

Here in the below sample code we have defined one main function (MainFunction) that has one local function(MultiplyBy10LocalFunction) defined inside it. And that local function has one more local function(Add10LocalFunction) defined inside it.

Hope it helps..