JSON Validator Tool

JSON Validator Tool

Another common task for us developers inside Azure Integration Services, especially inside Logic Apps, is manually creating a JSON message, either inside a Parse JSON action, Compose action, or directly in the connectors (or any other way), but there is a catch…

If you work in the Azure Portal and create an invalid JSON message inside an action or connector, the editor will not allow you to save the Logic App. Instead, it will give you an error saying that the definition contains invalid parameters.

However, if you are creating the same Logic App Consumption inside Visual Studio:

We can successfully validate this Logic App:

And we can actually successfully deploy this Logic App:

And that will become a problem once we run our Logic App. For this reason, it is always good for you to guarantee that the JSON message is well formatted before you deploy your business processes.

And yes, I know many only tools exist to perform this task, so why a Windows tool? Again, for the same reasons I described in my previous tools: security and privacy

I’m starting to become a freak in terms of security. Nothing is free, and the problem with these online tools is that we never know behind the scenes what they are doing. Are you sure that they are not keeping logs of the inputs we provide and the result outputs? And don’t say, but Sandro, this is just a simple message. Well, many messages have sensitive (private) information from users or companies that sometimes you are not aware of, so it is better to play safe than sorry. It is wise to be careful now so that problems do not occur later on and protect yourself against risk rather than be careless.

JSON Validator Tool

JSON Validator Tool is a lightweight Windows tool that allows you to validate and reformat a JSON message.

To not raise the same suspicions about this tool, the source code is available on GitHub!

Download

Hope you find this useful! So, if you liked the content or found it useful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! 

Credits

  • Diogo Formosinho | Member of my team and one of the persons responsible for developing this tool.
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

BizTalk Mapper Extensions UtilityPack: DateTime Functoids for BizTalk Server 2020

BizTalk Mapper Extensions UtilityPack: DateTime Functoids for BizTalk Server 2020

Today, after almost 3 years since I did the last update on the package, I updated it with a new suite of functoids that are now part of the BizTalk Mapper Extensions UtilityPack project available for BizTalk Server 2020: DateTime Functoids.

DateTime Functoids

This library includes a suite of functoids to perform several DateTime operations that you can use inside the BizTalk mapper.

This project, for now, only contains a single custom Functoid:

  • Get Current Date Functoid: This functoid allows you to get the current date and/or time in a specific format.
    • This functoid requires one input parameter:
      • date, time, or DateTime format;
    • Examples:
      • Input yyyyMMdd >>> Output = 20230526
      • Input HHmm >>> Output = 1519

BizTalk Mapper Extensions UtilityPack

BizTalk Mapper Extensions UtilityPack is a set of libraries with several useful functoids to include and use it in a map, which will provide an extension of BizTalk Mapper capabilities.

BizTalk Mapper Extensions UtilityPack for BizTalk Server 2020

Where can I download it?

You can download the complete Azure Function source code here:

Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

PowerShell script to download a specific version of WinSCP

PowerShell script to download a specific version of WinSCP

Today I was helping a BizTalk Server customer migrate their process from using the FTP adapter to the SFTP adapter. And if you are familiar with the BizTalk SFTP adapter, you will be aware of the painful process of choosing the correct version of WinSCP and how that hell we need to do to work correctly with the BizTalk Server, which is quite simple in general:

  • Download WinSCP and the .net Library, ensuring you get the correct version!
  • Copy the .exe and .dll to the BizTalk installation folder
  • DO NOT gac anything. If you GAC the .net library, it will not work because it expects WinSCP.exe to be in the same path, so that’s why they both go into the BizTalk installation folder.

However, the biggest issue is: what is the correct WinSCP version I need for my version of BizTalk Server 2016 or 2020?

And for that reason, Thomas E. Canter, on his day as a Phidiax consultant, decided to create this fantastic PowerShell script BizTalk WinSCP Installer, which during the years, has evolved and was improved by several people like Michael Stephenson, Nicolas Blatter, Niclas Öberg and myself.

If your environment has access to the internet, then I will recommend you use that script to install WinSCP! However, my client didn’t have access to the internet from the production server, and to complicate it a little bit, it didn’t have the same Build version. Let’s say in the test environment, it did have BizTalk Server 2016 with Feature Pack 3 and Cumulative Update 9, but in production, we would find BizTalk Server 2016 with Feature Pack 3 and Cumulative Update 5. That means we couldn’t copy the files from other environments to production. We had to use a different WinSCP version.

To address this scenario, I created a simple PowerShell version that you could choose the version you want to download and that you can run on any machine with access to the internet without checking the Build version you have in your environment.

This is a simple abstract of the PowerShell script:

$checkExeExists = Test-Path $targetNugetExe
if(-not $checkExeExists)
{
    if ($PSCmdlet.ShouldProcess("$sourceNugetExe -OutFile $targetNugetExe", "Run Invoke-WebRequest ")) {
        Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
        $targetNugetExeExists = Test-Path $targetNugetExe
        if (-not $targetNugetExeExists) {
            $Continue = $false
            Write-Error "`n$bangString";
            Write-Error "The download of the Nuget EXE from";
            Write-Error $sourceNugetExe;
            Write-Error "did not succeed";
            Write-Error "$bangString";
        }
        else{
            Write-Success "nuget.exe download successfully."
        }
    }
}

if ($PSCmdlet.ShouldProcess("$getWinSCP", "Run Command")) {
    Invoke-Expression "& $getWinSCP";
    $WinSCPEXEExists = Test-Path $WinSCPEXEDownload
    $WinSCPDLLExists = Test-Path $WinSCPDllDownload
    if (-not $WinSCPDLLExists) {
        $Continue = $false
        Write-Error "`n$bangString";
        Write-Error "WinSCP $winSCPVersion was not properly downloaded.";
        Write-Error "Check the folder and error messages above:";
        Write-Error "$nugetDownloadFolder";
        Write-Error "And determine what files did download or did not download.";
        Write-Error "$bangString";
    }
    else{
        Write-Success "WinSCP $winSCPVersion was properly downloaded."
    }
}

THESE POWERSHELL SCRIPTS ARE PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

Where can I download it?

You can download the complete Azure Function source code here:

Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

Azure Function to read key values from Azure App Configuration

Azure Function to read key values from Azure App Configuration

Almost 3 years ago, I wrote a blog post about How to get Key-values from Azure App Configuration within Logic Apps, and this is still valid today since we still don’t have an App Configuration Connector available out of the box. But I realize that I never blog about this resource in my blog.

There are many ways to store application configurations in Azure. At the top of the list is Key Vault which is ideal for storing secrets like passwords that should have limited access to the number of people that can see and modify these values.

However, not all configurations should need that tremendous restricted access. Neither all configurations are secrets. Of course, you can also use Key Vault to store non-secret information. But there are other options available like:

  • Using a SQL database with an app configuration table to store key values.
  • Depending on the services you are using, you can also use the default built-in App Configuration settings. For example, Azure Functions have it:

But you can also make use of the Azure App Configuration service.

Azure App Configuration stores configuration data as key-values. Key-values are a flexible and straightforward representation of developers’ application settings to make these configurations settings dynamic without redeploying your application if changes are required. However, they are not encrypted like the Key Vault, so it is a good solution to store non-sensitive data that you want to make dynamic in your application. 

Combining Azure App Configuration to store and manage your configurations and Azure Key Vault to store your secrets, we will obtain a powerful configuration management nearly for free.

App Configuration makes it easier to implement the following scenarios:

  • Centralize management and distribution of hierarchical configuration data for different environments and geographies
  • Dynamically change application settings without the need to redeploy or restart an application
  • Control feature availability in real-time

The only problem was that unlike Key Vault, which has an available connector to be used inside Logic Apps, App Configuration doesn’t have a connector available.

Get Azure App Configuration Value Function

This Function App is intended to close this gap and for you to be able to use it inside Logic Apps (or any other resource) and read App Configurations.

You can download the complete code for the function from GitHub. The link is below at the bottom of the blog post. Here is a small code snippet:

public static class GetAzureAppConfigurationValue
    {
        [FunctionName("GetAzureAppConfigurationValue")]
        public static async Task Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
            ILogger log)
        {
            string appKey = req.Query["appKey"];

            ....

            try
            {
                ...
                var builder = new ConfigurationBuilder();
                builder.AddAzureAppConfiguration(connectionString);
                var build = builder.Build();

                string keyValue = build[appKey.ToString()];

                if (string.IsNullOrEmpty(keyValue))
                {
                    ...
                }
                else return new OkObjectResult(keyValue);
            }
            catch(Exception ex)
            {
                var result = new ObjectResult(ex.Message);
                result.StatusCode = StatusCodes.Status500InternalServerError;
                return result;
            }
        }
    }

This function requires that you pass as a query parameter the appKey parameter:

  • https://URL?appKey=’’

Where can I download it?

You can download the complete Azure Function source code here:

Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

Note to myself: How to change the language in the Azure Portal

Note to myself: How to change the language in the Azure Portal

This is just another post for the sake of my mental sanity because I hate that Microsoft will induce, based on my location, that I intend for the Azure Portal to have my beloved Portuguese as the default language!

Don’t get me wrong, I’m proud to be Portuguese, and I do love my native language, but technically speaking, I hate to translate technical names into Portuguese for several reasons:

  • Sometimes direct translations do not work properly, and in some cases, the names/concepts are strange:
    • A queue (service bus) in Portuguese is “Fila” but “Fila” can be in English a row, a line, or indeed a queue > and this one is simple.
  • But most importantly, if I try or need to search for documentation or issues regarding some services, most of the resources will be in English.
  • Also, because I do have multiple clients across the world, speaking with them and sharing the screen with them will be easier if everything is in English.

I usually have all the portals and tools in English, but every now and then, I need to create a new profile on my browser, and there you go. I will end up with the Azure Portal in Portuguese and fighting to remember where to change the language, which by the way, is quite simple to achieve :).

To change the language settings in the Azure portal:

  • Click the Settings menu in the global page header.
  • Click the Language & region tab. Of course, depending on the current language, you will get a different name. Mine is “Idioma + região” (Portuguese).
  • Use the drop-downs to choose your preferred language and regional format settings.
  • Click Apply, in my case “Aplicar“, to update your language and regional format settings.

Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

May 22, 2023 Weekly Update on Microsoft Integration Platform & Azure iPaaS

May 22, 2023 Weekly Update on Microsoft Integration Platform & Azure iPaaS

__CONFIG_colors_palette__{“active_palette”:0,”config”:{“colors”:{“f3080”:{“name”:”Main Accent”,”parent”:-1},”f2bba”:{“name”:”Main Light 10″,”parent”:”f3080″},”trewq”:{“name”:”Main Light 30″,”parent”:”f3080″},”poiuy”:{“name”:”Main Light 80″,”parent”:”f3080″},”f83d7″:{“name”:”Main Light 80″,”parent”:”f3080″},”frty6″:{“name”:”Main Light 45″,”parent”:”f3080″},”flktr”:{“name”:”Main Light 80″,”parent”:”f3080″}},”gradients”:[]},”palettes”:[{“name”:”Default”,”value”:{“colors”:{“f3080”:{“val”:”rgb(23, 23, 22)”,”hsl”:{“h”:60,”s”:0.02,”l”:0.09}},”f2bba”:{“val”:”rgba(23, 23, 22, 0.5)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.5}},”trewq”:{“val”:”rgba(23, 23, 22, 0.7)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.7}},”poiuy”:{“val”:”rgba(23, 23, 22, 0.35)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.35}},”f83d7″:{“val”:”rgba(23, 23, 22, 0.4)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.4}},”frty6″:{“val”:”rgba(23, 23, 22, 0.2)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.2}},”flktr”:{“val”:”rgba(23, 23, 22, 0.8)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.8}}},”gradients”:[]},”original”:{“colors”:{“f3080”:{“val”:”rgb(23, 23, 22)”,”hsl”:{“h”:60,”s”:0.02,”l”:0.09}},”f2bba”:{“val”:”rgba(23, 23, 22, 0.5)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.5}},”trewq”:{“val”:”rgba(23, 23, 22, 0.7)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.7}},”poiuy”:{“val”:”rgba(23, 23, 22, 0.35)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.35}},”f83d7″:{“val”:”rgba(23, 23, 22, 0.4)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.4}},”frty6″:{“val”:”rgba(23, 23, 22, 0.2)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.2}},”flktr”:{“val”:”rgba(23, 23, 22, 0.8)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.8}}},”gradients”:[]}}]}__CONFIG_colors_palette__

Join me at INTEGRATE 2023 London | JUNE 5-7, 2023 | BizTalk Server to Azure Integration Services migration

Join me at INTEGRATE 2023 London | JUNE 5-7, 2023 | BizTalk Server to Azure Integration Services migration

INTEGRATE (formerly known as BizTalk Summit) is the primary conference for professionals working in the Microsoft Integration space and once again is back in London. From June 5 to 7, 26 speakers – 12 MVPs, 1 former MVP, and 12 Microsoft PM – will address the entire Microsoft Integration Platform landscape on topics like BizTalk Server, Logic Apps, Service Bus, Event Grid, Event Hubs, Microsoft Flow, API Management, Azure Functions and many more.

And once again, I will be there delivering a session! Since the first BizTalk Summit event, I’ve been a constant presence as a speaker at these events! However, this will be the first time I’m not going to deliver a session 100% dedicated to BizTalk Server. This time I’ll be talking about how you can migrate your BizTalk Server solution to Azure Integration Services.

You could also get an exclusive 15% discount on top of the existing early bird offer using the coupon code “INT2023-SPEAKER-SANDRO”.

About my session

Session Name: BizTalk Server to Azure Integration Services migration

Abstract: If you are embracing the journey to move your current BizTalk Server environment to the cloud, we will discuss what you need to be aware of in this session. From the preparation phase – the assessment phase to the tools and technology you can use, some best practices you may implement, what to do and not to do, and finally, presenting some samples.

Content is not all you get from this event…

Content is hugely important, and as you read previously, this event will address the entire Microsoft Integration Platform landscape… but that’s not all!

This will also be a fantastic opportunity to Network, Connect, and Reconnect with Colleagues. Meet some of the people you have been following on Twitter and blogs and network with them and others who are interested in the same things you are. To hang out with the most brilliant people you know – and I’m not talking about the speakers or Microsoft PMs! I’m talking about you guys! – last year, we had more than 200 attendees from several companies across many countries attending the event, and it was the first personal event after COVID-19, this year will be bigger! Imagine the experience that all of us have combined!

The knowledge and experience of all the attendees, speakers, and product group members at these events are unreal!!! You will not find an opportunity like this every day.

So, this event is a massive opportunity for you to:

  • Get insight and answers to your questions from these real-world experts: attendees, MVPs, and/or Microsoft PMs;
  • Know and become friends with people you are interested in or that you follow on social media and participate in post-event activities like coffee breaks and dinner with speakers and/or other attendees.
  • Build your personal Business Networking, and it is also a good opportunity for Partnerships… and new business opportunities.

And finally: Refresh and recharge and have some fun!

Fill free to contact DevScope at info@devscope.net if you want to know more about us, what we do, and/or how we can help you and your business.

INTEGRATE 2023 Registration

You are still on time to register for the conference here.

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

How to create a Logic App Consumption Visual Studio project

How to create a Logic App Consumption Visual Studio project

Unfortunately, until this date, there isn’t available an Azure Logic Apps Tools for Visual Studio Extension for Visual Studio 2022, which means that we still need to use Visual Studio 2019 to create Logic App Consumption projects with Visual Studio.

An opposite to other Azure Services like Azure Functions that have a dedicated Azure Function project Template:

There isn’t a Logic App Consumption Visual Studio project template. Instead, we need to use the Azure Resource Group project template, and inside we will select that it will be applying a Logic App template.

Creating a Visual Studio Logic App Consumption project

The Logic Apps designer integrates with the current Azure Resource Group project. That saying, you will not find any Logic App template in the list of templates. Instead, we need to create an Azure Resource Group project to get started, and to do that, we need:

  • Open Visual Studio, and on the Create a new project panel, select C# -> Azure -> Cloud, or search for Azure Resource Group:
    • From the list of project templates, select the Azure Resource Group template.
  • On the Configure your new project panel, give a proper Project name, Location, and Solution name. Leave the Framework as .NET Framework 4.7.2 and select Create.
  • Finally, on the Select Azure Template panel, from the Visual Studio Templates list, select the Logic App template and select OK.

This will create an empty Visual Studio Logic App solution. Now on the Visual Studio solution:

  • Right-click on the LogicApp.json file and select Open With Logic App Designer.
  • This will open a Logic App Properties window, where you need to:
    • Define the credentials to authenticate on the Azure subscription.
    • Define the Subscription and Resource Group where you want to create these resources.
    • Define if you want the Location to be in the same Region or in an Integration Service Environment (ISE) – be aware the ISE is being deprecated.
  • And then select OK.

This will embed the Logic App designer inside the Visual Studio.

Now you need to select a common trigger, a template, or use a blank Logic App to start creating your business process.

Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira

May 15, 2023 Weekly Update on Microsoft Integration Platform & Azure iPaaS

May 15, 2023 Weekly Update on Microsoft Integration Platform & Azure iPaaS

__CONFIG_colors_palette__{“active_palette”:0,”config”:{“colors”:{“f3080”:{“name”:”Main Accent”,”parent”:-1},”f2bba”:{“name”:”Main Light 10″,”parent”:”f3080″},”trewq”:{“name”:”Main Light 30″,”parent”:”f3080″},”poiuy”:{“name”:”Main Light 80″,”parent”:”f3080″},”f83d7″:{“name”:”Main Light 80″,”parent”:”f3080″},”frty6″:{“name”:”Main Light 45″,”parent”:”f3080″},”flktr”:{“name”:”Main Light 80″,”parent”:”f3080″}},”gradients”:[]},”palettes”:[{“name”:”Default”,”value”:{“colors”:{“f3080”:{“val”:”rgb(23, 23, 22)”,”hsl”:{“h”:60,”s”:0.02,”l”:0.09}},”f2bba”:{“val”:”rgba(23, 23, 22, 0.5)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.5}},”trewq”:{“val”:”rgba(23, 23, 22, 0.7)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.7}},”poiuy”:{“val”:”rgba(23, 23, 22, 0.35)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.35}},”f83d7″:{“val”:”rgba(23, 23, 22, 0.4)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.4}},”frty6″:{“val”:”rgba(23, 23, 22, 0.2)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.2}},”flktr”:{“val”:”rgba(23, 23, 22, 0.8)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.8}}},”gradients”:[]},”original”:{“colors”:{“f3080”:{“val”:”rgb(23, 23, 22)”,”hsl”:{“h”:60,”s”:0.02,”l”:0.09}},”f2bba”:{“val”:”rgba(23, 23, 22, 0.5)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.5}},”trewq”:{“val”:”rgba(23, 23, 22, 0.7)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.7}},”poiuy”:{“val”:”rgba(23, 23, 22, 0.35)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.35}},”f83d7″:{“val”:”rgba(23, 23, 22, 0.4)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.4}},”frty6″:{“val”:”rgba(23, 23, 22, 0.2)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.2}},”flktr”:{“val”:”rgba(23, 23, 22, 0.8)”,”hsl_parent_dependency”:{“h”:60,”s”:0.02,”l”:0.09,”a”:0.8}}},”gradients”:[]}}]}__CONFIG_colors_palette__

Azure Functions DateTime Conversion

Azure Functions DateTime Conversion

It is Friday, and just for fun and also because I would like to have a watch (one of my passions) in the cover picture, I decided to migrate a subset of an old project of mine: BizTalk MapperExtensions UtilityPack to Azure Functions, in this case, DateTime Conversion Functoids. You never know if they will be handy someday!

This project includes a list of Azure Functions that make data conversions easy to accomplish and that you can use anywhere, but most likely, I was thinking of using them inside Logic Apps if I will have a need to do this kind of task if they are not available out-of-the-box inside Logic Apps – and I know that some of them are not:

  • Convert from human-readable to epoch date function.
  • Convert from epoch to human readable date function.
  • And Convert date time format function.

Convert from human-readable to epoch date function.

This function allows you to convert a traditional date (Human Readable Date) into a Unix date (Epoch Date).

What is epoch time?

The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking, the epoch is Unix time 0 (midnight 1-1-1970), but ‘epoch’ is often used as a synonym for ‘Unix time’. Many Unix systems store epoch dates as a signed 32-bit integer, which might cause problems on January 19, 2038 (known as the Year 2038 problem or Y2038).

The function receives a JSON payload with two properties:

  • The input Date or DateTime.
  • And a string describing the input format of the first parameter

Example:

{
    "datetime":"05-09-2012 14:00:00",
    "format":"dd-MM-yyyy HH:mm:ss"
}

The function’s output is a long value, representing the epoch date. For example: 1346850000

Convert from epoch to human readable date function.

This function allows you to convert a Unix date (Epoch Date) into a traditional date (Human Readable Date).

The function receives a JSON payload with one property:

  • A Unix date value.

Example:

{
    "unixtime": 1346850000
}

The function’s output is a date time in a string format: “2012-09-05T13:00:00”

And Convert date time format function.

Finally, this function allows you to convert the DateTime format into another DateTime format.

The function receives a JSON payload with three properties:

  • The input Date or DateTime.
  • A string describing the input format of the first parameter.
  • A string describing the output format of the first parameter.

Example:

{
    "inputDate": "05-09-2012 14:00:00",
    "inputFormat": "dd-MM-yyyy HH:mm:ss",
    "outputFormat": "yyyy-MM-dd HH:mm:ss"
}

The function’s output is a DateTime string according to the output format specified : “2012-09-05 14:00:00”

Where can I download it

You can download the complete Azure Functions source code here:

Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira