<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nicola Biancolini</title>
    <description>The latest articles on DEV Community by Nicola Biancolini (@binick).</description>
    <link>https://dev.to/binick</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F441055%2F46d32d14-a935-46c1-a020-9afea99d0be3.png</url>
      <title>DEV Community: Nicola Biancolini</title>
      <link>https://dev.to/binick</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/binick"/>
    <language>en</language>
    <item>
      <title>Micro frontends and Blazor Server, the beginning of the journey</title>
      <dc:creator>Nicola Biancolini</dc:creator>
      <pubDate>Wed, 01 Jun 2022 07:21:35 +0000</pubDate>
      <link>https://dev.to/binick/micro-frontends-and-blazor-server-the-beginning-of-the-journey-421m</link>
      <guid>https://dev.to/binick/micro-frontends-and-blazor-server-the-beginning-of-the-journey-421m</guid>
      <description>&lt;p&gt;I was recently asked to make a &lt;strong&gt;spike&lt;/strong&gt;&lt;sup id="fnref1"&gt;1&lt;/sup&gt; to evaluate the feasibility of implementing a &lt;strong&gt;micro frontends&lt;/strong&gt; architecture with &lt;strong&gt;Blazor Server&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I'll tell you right now that it was a &lt;strong&gt;failure&lt;/strong&gt;; but let's go in order, first analyzing the declension of the term &lt;em&gt;failure&lt;/em&gt; and the reasons that led me to use it and then try to recapitulate what emerged from this exploration that led me to this conclusion.&lt;/p&gt;

&lt;p&gt;I really like the definition he gives &lt;a href="https://www.treccani.it/vocabolario"&gt;Treccani&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Riconoscere l'inutilità dei propri sforzi, l'impossibilità e incapacità di raggiungere gli scopi fissati, rinunciando definitivamente alla lotta, all'azione.&lt;/p&gt;

&lt;p&gt;-- &lt;cite&gt;&lt;a href="https://www.treccani.it/vocabolario/fallimento"&gt;Treccani&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Which translated, hoping to do it correctly, would be "&lt;em&gt;Recognizing the futility of one's efforts, the impossibility and inability to achieve the set goals, definitely giving up the struggle, action.&lt;/em&gt;"&lt;/p&gt;

&lt;p&gt;I find it particularly proper because it uses the term &lt;em&gt;fixed scopes&lt;/em&gt;, and so what are those purposes?&lt;/p&gt;

&lt;h2&gt;
  
  
  Context matters.
&lt;/h2&gt;

&lt;p&gt;Nothing is done by accident, and this is certainly no exception. The work done is part of a larger context involving the need to migrate a number of &lt;em&gt;ASP.NET MVC 5&lt;/em&gt; applications to &lt;em&gt;ASP.NET Core&lt;/em&gt; combined with a desire to make the current architecture more flexible by introducing the concept of &lt;strong&gt;modular-programming&lt;/strong&gt;&lt;sup id="fnref2"&gt;2&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;Without getting around too much, the ultimate goal was to measure the feasibility of "realizing" a &lt;em&gt;micro frontends&lt;/em&gt; architecture rendered server-side thanks to &lt;em&gt;Blazor Server&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In this regard on &lt;a href="https://martinfowler.com/"&gt;Martin Fowler's&lt;/a&gt; blog there is a nice article by &lt;a href="https://camjackson.net/"&gt;Cam Jackson&lt;/a&gt; in which an &lt;a href="https://martinfowler.com/articles/micro-frontends.html"&gt;overview of this architecture&lt;/a&gt; is given and from which I have translated their definition of &lt;em&gt;micro frontends&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An architectural style where independently deliverable frontend applications are composed into a greater whole.&lt;/p&gt;

&lt;p&gt;-- &lt;cite&gt;&lt;a href="https://martinfowler.com/articles/micro-frontends.html"&gt;Thoughtworks su martinfowler.com&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I put realize in quotes since the deployment of the various sites would only ever be done in a unified manner.&lt;br&gt;&lt;br&gt;
Perhaps we would address this issue in a future post.&lt;/p&gt;
&lt;h2&gt;
  
  
  Not all donuts come out with a hole.
&lt;/h2&gt;

&lt;p&gt;
  Don't you know what it means?
  &lt;br&gt;
A clear explanation of what this Italian saying means I found in &lt;a href="https://www.clozemaster.com/blog/italian-sayings/"&gt;Clozemaster&lt;/a&gt; at point 4.&lt;br&gt;
Anyway, in two words it means that despite failure there is still something left to eat!&lt;br&gt;


&lt;/p&gt;

&lt;p&gt;Getting straight to the point, the main reason for the failure is related to the inability to give &lt;a href="https://martinfowler.com/articles/micro-frontends.html#AutonomousTeams"&gt;complete autonomy to the teams&lt;/a&gt;, for two main distinct reasons.&lt;/p&gt;

&lt;h3&gt;
  
  
  Homonymy in support for pages and views &lt;em&gt;Razor&lt;/em&gt;.
&lt;/h3&gt;

&lt;p&gt;To compose the site each &lt;em&gt;frontends&lt;/em&gt; is contained within a &lt;strong&gt;Razor&lt;/strong&gt; class library which also holds the view that is responsible for doing &lt;a href="https://docs.microsoft.com/aspnet/core/blazor/fundamentals/routing#aspnet-core-endpoint-routing-integration"&gt;hosting&lt;/a&gt; of the &lt;em&gt;Blazor&lt;/em&gt; application.&lt;/p&gt;

&lt;p&gt;This is made possible by the functionality exposed by the &lt;em&gt;SDK&lt;/em&gt; that allows a &lt;em&gt;web app&lt;/em&gt; to use &lt;em&gt;Razor&lt;/em&gt; views, pages, or layouts from class libraries and, as defined in the &lt;a href="https://docs.microsoft.com/aspnet/core/razor-pages/ui-class#override-views-partial-views-and-pages-2"&gt;official documentation&lt;/a&gt;, in case of homonymy, precedence is given to the view, page, layout present in the &lt;em&gt;web app&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In my case I am in a situation like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VT06foIR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q35dvrag4njlyf2ki0hf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VT06foIR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q35dvrag4njlyf2ki0hf.png" alt="Figure 1: an ASP.NET Core application referencing two *Razor Class Library* representing two modules." width="321" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;where both modules internally make use of layouts contained at the &lt;code&gt;/Pages/Shared/_Layout.cshtml&lt;/code&gt; path.&lt;/p&gt;

&lt;p&gt;Here, what would happen in this case is that one of the two teams would be displeased since, if it went well it would see its application rendered inside another layout, in the worst case one part or all of the views would go wrong (e.g., a view tries to enhance a &lt;a href="https://docs.microsoft.com/aspnet/core/mvc/views/razor#section"&gt;section&lt;/a&gt; not declared in the layout).&lt;br&gt;&lt;br&gt;
And we note well that both modules executed independently would behave as expected.&lt;/p&gt;

&lt;h3&gt;
  
  
  Routes, the basic route that does not want to work.
&lt;/h3&gt;

&lt;p&gt;I have that at least I could not get it to work.&lt;/p&gt;

&lt;p&gt;Again, following the principle of autonomy, the desired was to separate the module routes from the container routes, for example within &lt;em&gt;Module A&lt;/em&gt; we would find &lt;code&gt;/&lt;/code&gt; or &lt;code&gt;/index&lt;/code&gt; while from the container perspective the routes would be &lt;code&gt;/module-a/&lt;/code&gt; or &lt;code&gt;/module-a/index&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What I found was a "short blanket," when internal navigation within the module worked, route generation using &lt;a href="https://docs.microsoft.com/aspnet/core/mvc/views/tag-helpers/built-in/anchor-tag-helper"&gt;&lt;em&gt;Anchor Tag Helper&lt;/em&gt;&lt;/a&gt; did not work (remember that this &lt;em&gt;spike&lt;/em&gt; is the result of a migration process), as I used the middleware &lt;a href="https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http.Abstractions/src/Extensions/UsePathBaseMiddleware.cs"&gt;&lt;code&gt;UsePathBaseMiddleware&lt;/code&gt;&lt;/a&gt; for the implementation of the requirement.&lt;/p&gt;

&lt;p&gt;This resulted in the generation of links within the module to the outside always adding the &lt;code&gt;/module-a&lt;/code&gt; at the top of the address even as the link should have simply pointed to the container.&lt;/p&gt;

&lt;p&gt;Otherwise using middleware I would have been forced to use the module name at the top of all &lt;a href="https://docs.microsoft.com/aspnet/core/mvc/views/razor#page"&gt;&lt;code&gt;@page&lt;/code&gt;&lt;/a&gt; directives.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions.
&lt;/h2&gt;

&lt;p&gt;Summing up what has been done and reasoning with a cool mind I could say that something good we can still take home, in fact, by not enabling support for &lt;em&gt;Razor&lt;/em&gt; pages and views in a &lt;em&gt;RCL&lt;/em&gt;&lt;sup id="fnref3"&gt;3&lt;/sup&gt; and avoiding the use of &lt;em&gt;Anchor Tag Helper&lt;/em&gt; in the HTML markup that contributes to view rendering we would not run into these problems.&lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;A spike is a product development method originating from extreme programming that uses the simplest possible program to explore potential solutions. Source &lt;a href="https://en.wikipedia.org/wiki/Spike_(software_development)"&gt;Wikipedia&lt;/a&gt;. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn2"&gt;
&lt;p&gt;Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each holds everything necessary to execute only one aspect of the desired functionality. Source &lt;a href="https://en.wikipedia.org/wiki/Modular_programming"&gt;Wikipedia&lt;/a&gt;. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn3"&gt;
&lt;p&gt;&lt;a href="https://docs.microsoft.com/aspnet/core/razor-pages/ui-class"&gt;Razor Class libraries (RCLs)&lt;/a&gt; were introduced in ASP.NET Core 2.1 as a way to package and distribute UI components to be referenced and consumed within a host application. ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>blazor</category>
      <category>dotnet</category>
      <category>microservices</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>That time I tasted a frog</title>
      <dc:creator>Nicola Biancolini</dc:creator>
      <pubDate>Fri, 18 Feb 2022 21:52:58 +0000</pubDate>
      <link>https://dev.to/binick/that-time-i-tasted-a-frog-5d1a</link>
      <guid>https://dev.to/binick/that-time-i-tasted-a-frog-5d1a</guid>
      <description>&lt;p&gt;I started working in remote mode in March 2020, the reason I guess we all know.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;However, if an extra-terrestrial were to read this post, he can find more information here &lt;a href="https://wikipedia.org/wiki/COVID-19"&gt;https://wikipedia.org/wiki/COVID-19&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;My experience has been the same as that of so many others, a maximum and indiscriminate use of communication platforms and smoking ears at the end of the day.&lt;br&gt;&lt;br&gt;
This working mode went on for about a year and a half, 16 months to be precise, until July 2021 when I joined &lt;a href="https://www.manageddesigns.it/"&gt;&lt;em&gt;managed/designs&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here I found a different environment, which some would call &lt;em&gt;smart&lt;/em&gt;. Devoted to personal growth and continuous improvement where autonomy and trust are two pillars on which the daily collaboration is based.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prologue.
&lt;/h2&gt;

&lt;p&gt;I've never been a user of to-do lists, perhaps due to inexperience or perhaps due to some belief unknown to me. The fact is that the systematic failure to follow the shopping list is proof of it &lt;em&gt;"Nicola is not able to manage the lists"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Once I became aware of this, I started looking for possible patterns and/or methodologies by identifying some that have accompanied me for a couple of months.&lt;/p&gt;

&lt;h2&gt;
  
  
  My inbox is not the email.
&lt;/h2&gt;

&lt;p&gt;I realized that what I need is not a list of tasks &lt;em&gt;to do&lt;/em&gt; but rather a list of things that I &lt;em&gt;would like to do&lt;/em&gt; or that somehow pique my interest. I suspect that on a subconscious level, my brain takes optimistically to the presence of that &lt;em&gt;"would like"&lt;/em&gt; that removes the pressure for things that shouldn't be there.&lt;/p&gt;

&lt;p&gt;I have three emails, the corporate one and two other historical ones that I've been carrying around for at least a decade, all three of which follow the philosophy of &lt;a href="https://www.43folders.com/izero"&gt;Inbox Zero&lt;/a&gt; by &lt;a href="http://www.merlinmann.com/"&gt;Merlin Mann&lt;/a&gt;. I currently flip through them twice a day, roughly before lunch and before the end of the day, these slots are recurring appointments on the calendar until next June 29, so we'll see if they will be extended, but I think so.&lt;/p&gt;

&lt;p&gt;The rule is very easy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it is important and must be executed at a specific time: an appointment is created on the calendar and archived in the corresponding inbox&lt;/li&gt;
&lt;li&gt;it is important: it ends up in the &lt;em&gt;inbox&lt;/em&gt; and archived&lt;/li&gt;
&lt;li&gt;it interests me: it ends up in the &lt;em&gt;inbox&lt;/em&gt; and deleted&lt;/li&gt;
&lt;li&gt;it doesn't interest me: it ends up in the trash&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this way, I always have free inboxes and can keep my attention on those ten or so emails.&lt;/p&gt;

&lt;p&gt;If an email comes in requesting an active response, I won't run it right away, but like the others, it will follow the rules above.&lt;/p&gt;

&lt;h2&gt;
  
  
  One frog a day is enough.
&lt;/h2&gt;

&lt;p&gt;The other enlightening technique for me was the discovery of the 1-3-5 rule&lt;sup id="fnref1"&gt;1&lt;/sup&gt; based on the practice of eating a frog as soon as you wake up&lt;sup id="fnref2"&gt;2&lt;/sup&gt;. Obviously not physically, I never want to wake up, and I've also been getting very little sleep lately!&lt;/p&gt;

&lt;p&gt;So the day before I make a list of what I'd like to do the next day, applying some sort of empirical prioritization of activities of the moment while always making sure there's at least one frog and possibly other filler activities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Epilogue.
&lt;/h2&gt;

&lt;p&gt;I have to be honest, at first I was skeptical about taking the time to plan my tomorrow. I have to reconsider. The benefits of freeing my brain from the burden of thinking about what to do so that I don't run the risk of losing it forever is something to be reckoned with.&lt;/p&gt;

&lt;p&gt;Right now, the rigidity of the calendar and the flexibility that the 1-3-5 list leaves me with are a good match. Only time will tell if it is a winning choice for me.&lt;/p&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;&lt;a href="https://www.themuse.com/advice/why-you-never-finish-your-todo-lists-at-work-and-how-to-change-that"&gt;Why You Never Finish Your To-Do Lists at Work (And How to Change That)&lt;/a&gt; by &lt;a href="https://www.themuse.com/author/alex-cavoulacos"&gt;Alex Cavoulacos&lt;/a&gt; ↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn2"&gt;
&lt;p&gt;&lt;a href="https://www.briantracy.com/blog/time-management/the-truth-about-frogs"&gt;Eat That Frog: Brian Tracy Explains the Truth About Frogs&lt;/a&gt; by Brian Tracy ↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>productivity</category>
      <category>beginners</category>
      <category>devjournal</category>
      <category>management</category>
    </item>
    <item>
      <title>Develop integrated solutions with Active Directory B2C and Azure Event Grid.</title>
      <dc:creator>Nicola Biancolini</dc:creator>
      <pubDate>Fri, 14 Jan 2022 11:35:52 +0000</pubDate>
      <link>https://dev.to/binick/develop-integrated-solutions-with-active-directory-b2c-and-azure-event-grid-4iji</link>
      <guid>https://dev.to/binick/develop-integrated-solutions-with-active-directory-b2c-and-azure-event-grid-4iji</guid>
      <description>&lt;p&gt;We will see how it is possible to create a solution that integrates &lt;em&gt;Azure Active Directory B2C&lt;/em&gt; to save on &lt;em&gt;Blob Storage&lt;/em&gt; dummy data at user registration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution overview.
&lt;/h2&gt;

&lt;p&gt;The solution is composed as follows:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7eBxcFGR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ryx0b1bomphvks2uoed2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7eBxcFGR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ryx0b1bomphvks2uoed2.png" alt="Component map" width="880" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;read-customer-details-identity-la&lt;/code&gt;: represents the API whose purpose is to retrieve the content of the &lt;em&gt;blob&lt;/em&gt; from &lt;code&gt;customersstgacc&lt;/code&gt; (the &lt;em&gt;storage account&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;customer-register-tpc&lt;/code&gt;: is the &lt;em&gt;topic&lt;/em&gt; in which are collected the events of the creation of a new user&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;customer-identity-details-filler-la&lt;/code&gt;: it represents the API that is in charge of generating fictitious data that will be saved inside a &lt;em&gt;blob&lt;/em&gt; on the &lt;code&gt;customersstgacc&lt;/code&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZsZ-IKlZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o9rso6pnttkjzq0efgc3.png" alt="steps" width="880" height="426"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;contoso-b2c&lt;/code&gt;: is the access and identity management service offered by &lt;em&gt;Azure&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction to &lt;em&gt;Azure Event Grid&lt;/em&gt;.
&lt;/h2&gt;

&lt;p&gt;In &lt;em&gt;Azure&lt;/em&gt; there is an implementation of the &lt;a href="https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern"&gt;publish/subscribe&lt;/a&gt; pattern designed to facilitate integration and resource management via an event-driven development paradigm.&lt;/p&gt;

&lt;p&gt;Through the &lt;em&gt;Event Grid&lt;/em&gt; will be possible to subscribe to &lt;a href="https://docs.microsoft.com/azure/event-grid/overview#event-sources"&gt;built-in message sources&lt;/a&gt; via a &lt;a href="https://docs.microsoft.com/azure/event-grid/overview#event-handlers"&gt;set of handlers&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If this is not enough, it is possible to create custom _topics to which you can subscribe to receive events.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a custom &lt;em&gt;topic&lt;/em&gt;.
&lt;/h2&gt;

&lt;p&gt;You can refer to &lt;a href="https://docs.microsoft.com/azure/event-grid/custom-event-quickstart-portal#create-a-custom-topic"&gt;this guide&lt;/a&gt; to create a &lt;em&gt;topic&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;One choice to make when creating the &lt;em&gt;topic&lt;/em&gt; concerns the scheme of the &lt;em&gt;HTTP&lt;/em&gt; request content used. Currently, supported schemas are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/azure/event-grid/event-schema"&gt;&lt;code&gt;Event Grid Schema&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/azure/event-grid/cloud-event-schema"&gt;&lt;code&gt;Cloud Event Schema&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Custom Input Schema&lt;/code&gt; this schema will require the creation of an &lt;a href="https://docs.microsoft.com/azure/event-grid/input-mappings"&gt;association&lt;/a&gt; between the properties of the input object and those required by the &lt;code&gt;Event Grid Schema&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The message used in this case has the following structure&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"objectId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"25100647-0dcc-4571-b7b4-b03e4ce72d02"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;unique&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;user&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;identifier&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"25100647-0dcc-4571-b7b4-b03e4ce72d02"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;unique&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;message&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;identifier&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;the&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;same&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;`data.objectId`&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;this&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;case&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"eventType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Microsoft.ActiveDirectory"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
        &lt;/span&gt;&lt;span class="nl"&gt;"subject"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"contosob2cqtofmpm.onmicrosoft.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"dataVersion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"metadataVersion"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"eventTime"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2021-12-03T21:04:03.8504745Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"topic"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/subscriptions/{your-subscription-id}/resourceGroups/{your-resource-group}/providers/Microsoft.EventGrid/topics/{your-event-grid-topic}"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Issuing the registration event.
&lt;/h2&gt;

&lt;p&gt;Sending events to the &lt;em&gt;topic&lt;/em&gt; is done using a &lt;a href="https://docs.microsoft.com/azure/active-directory-b2c/restful-technical-profile"&gt;&lt;code&gt;RESTful technical profile&lt;/code&gt;&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;TechnicalProfile&lt;/span&gt; &lt;span class="na"&gt;Id=&lt;/span&gt;&lt;span class="s"&gt;"AAD-UserEmitRegistrationEvent"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;DisplayName&amp;gt;&lt;/span&gt;Emit user registration event to Event Grid.&lt;span class="nt"&gt;&amp;lt;/DisplayName&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Protocol&lt;/span&gt; &lt;span class="na"&gt;Name=&lt;/span&gt;&lt;span class="s"&gt;"Proprietary"&lt;/span&gt; &lt;span class="na"&gt;Handler=&lt;/span&gt;&lt;span class="s"&gt;"Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;Metadata&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;Item&lt;/span&gt; &lt;span class="na"&gt;Key=&lt;/span&gt;&lt;span class="s"&gt;"ServiceUrl"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;{Settings:CustomerRegisteredTopicUrl}&lt;span class="nt"&gt;&amp;lt;/Item&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;Item&lt;/span&gt; &lt;span class="na"&gt;Key=&lt;/span&gt;&lt;span class="s"&gt;"AuthenticationType"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;ApiKeyHeader&lt;span class="nt"&gt;&amp;lt;/Item&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;Item&lt;/span&gt; &lt;span class="na"&gt;Key=&lt;/span&gt;&lt;span class="s"&gt;"SendClaimsIn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Body&lt;span class="nt"&gt;&amp;lt;/Item&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;Item&lt;/span&gt; &lt;span class="na"&gt;Key=&lt;/span&gt;&lt;span class="s"&gt;"ClaimUsedForRequestPayload"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;userRegisterEvent&lt;span class="nt"&gt;&amp;lt;/Item&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;Item&lt;/span&gt; &lt;span class="na"&gt;Key=&lt;/span&gt;&lt;span class="s"&gt;"DefaultUserMessageIfRequestFailed"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Cannot process your request right now, please try again later.&lt;span class="nt"&gt;&amp;lt;/Item&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/Metadata&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;CryptographicKeys&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;Key&lt;/span&gt; &lt;span class="na"&gt;Id=&lt;/span&gt;&lt;span class="s"&gt;"aeg-sas-key"&lt;/span&gt; &lt;span class="na"&gt;StorageReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"B2C_1A_CustomerRegisteredTopicSas"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/CryptographicKeys&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;InputClaimsTransformations&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;InputClaimsTransformation&lt;/span&gt; &lt;span class="na"&gt;ReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"GetSystemDateTime"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;InputClaimsTransformation&lt;/span&gt; &lt;span class="na"&gt;ReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"GenerateRegistrationEventRequest"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/InputClaimsTransformations&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;InputClaims&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;InputClaim&lt;/span&gt; &lt;span class="na"&gt;ClaimTypeReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"userRegisterEvent"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/InputClaims&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;PersistedClaims&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;PersistedClaim&lt;/span&gt; &lt;span class="na"&gt;ClaimTypeReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"systemDateTime"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/PersistedClaims&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;UseTechnicalProfileForSessionManagement&lt;/span&gt; &lt;span class="na"&gt;ReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"SM-AAD"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/TechnicalProfile&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This fragment of markup translated into &lt;code&gt;curl&lt;/code&gt; command, for more explicability, would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"aeg-sas-key: &lt;/span&gt;&lt;span class="nv"&gt;$key&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$event&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nv"&gt;$endpoint&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where the authentication requirements are met by the &lt;code&gt;AuthenticationType&lt;/code&gt; metadata to which is associated the cryptographic key &lt;code&gt;aeg-sas-key&lt;/code&gt; whose value is retrieved from the key &lt;code&gt;B2C_1A_CustomerRegisteredTopicSas&lt;/code&gt; present in the collection of &lt;a href="https://docs.microsoft.com/azure/active-directory-b2c/policy-keys-overview?pivots=b2c-custom-policy"&gt;policy keys&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"TL;DR"&lt;br&gt;
The choice of the &lt;em&gt;topic&lt;/em&gt; template in this example was guided by the limitations currently imposed by the &lt;a href="https://docs.microsoft.com/azure/active-directory-b2c/restful-technical-profile"&gt;&lt;em&gt;RESTful&lt;/em&gt; technical profile&lt;/a&gt; regarding the possibilities of building the &lt;em&gt;HTTP&lt;/em&gt; request, in fact for a combination of criteria it is not possible to pass information in the headers and the body of the request at the same time.&lt;br&gt;&lt;br&gt;
This makes it impossible to send towards a &lt;em&gt;topic&lt;/em&gt; schemes of type &lt;code&gt;Cloud Event&lt;/code&gt; since the protocol, in version &lt;em&gt;1.0&lt;/em&gt; requires the presence of a &lt;a href="https://docs.microsoft.com/azure/event-grid/cloud-event-schema#sample-event-using-cloudevents-schema"&gt;mandatory header&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Much more complex is the creation of the body of the request for which it is necessary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;use the &lt;a href="https://docs.microsoft.com/azure/active-directory-b2c/technicalprofiles#input-claims-transformations"&gt;&lt;code&gt;InputClaimsTransformation&lt;/code&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;add two statements inside the baggage &lt;code&gt;userRegisterEvent&lt;/code&gt; and &lt;code&gt;systemDateTime&lt;/code&gt; both of type &lt;em&gt;string&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, the &lt;em&gt;technical profile&lt;/em&gt; has been added among the &lt;em&gt;technical validation profiles&lt;/em&gt; of &lt;a href="https://github.com/binick/samples/blob/7782bd6bfcfcb8c2b18dc911d501b29ec05f8212/src/enrich-a-jwt-token-with-ief/ief/TrustFrameworkBase.xml#L764"&gt;&lt;code&gt;LocalAccountSignUpWithLogonEmail&lt;/code&gt;&lt;/a&gt; so that the event is issued only when a user is registered.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using claim transformations.
&lt;/h3&gt;

&lt;p&gt;During the creation of &lt;em&gt;custom criteria&lt;/em&gt; we could have the necessity to execute calculations, as the number of attempts of authentication, that even if very simple would result impossible without the execution of functions.&lt;/p&gt;

&lt;p&gt;This requirement finds expressivity through the &lt;code&gt;ClaimsTransformation&lt;/code&gt; whose &lt;a href="https://docs.microsoft.com/azure/active-directory-b2c/claimstransformations#claims-transformations-reference"&gt;reference of the transformations of the claims&lt;/a&gt; contains the complete list of the &lt;em&gt;transformations&lt;/em&gt; usable.&lt;/p&gt;

&lt;p&gt;In the example the methods &lt;a href="https://docs.microsoft.com/azure/active-directory-b2c/date-transformations#getcurrentdatetime"&gt;&lt;code&gt;GetCurrentDateTime&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://docs.microsoft.com/azure/active-directory-b2c/json-transformations#generatejson"&gt;&lt;code&gt;GenerateJson&lt;/code&gt;&lt;/a&gt; were used&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ClaimsTransformation&lt;/span&gt; &lt;span class="na"&gt;Id=&lt;/span&gt;&lt;span class="s"&gt;"GetSystemDateTime"&lt;/span&gt; &lt;span class="na"&gt;TransformationMethod=&lt;/span&gt;&lt;span class="s"&gt;"GetCurrentDateTime"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;OutputClaims&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;OutputClaim&lt;/span&gt; &lt;span class="na"&gt;ClaimTypeReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"systemDateTime"&lt;/span&gt; &lt;span class="na"&gt;TransformationClaimType=&lt;/span&gt;&lt;span class="s"&gt;"currentDateTime"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/OutputClaims&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/ClaimsTransformation&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The purpose of &lt;code&gt;GetSystemDateTime&lt;/code&gt; is to enhance the &lt;code&gt;systemDateTime&lt;/code&gt; claim.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;ClaimsTransformation&lt;/span&gt; &lt;span class="na"&gt;Id=&lt;/span&gt;&lt;span class="s"&gt;"GenerateRegistrationEventRequest"&lt;/span&gt; &lt;span class="na"&gt;TransformationMethod=&lt;/span&gt;&lt;span class="s"&gt;"GenerateJson"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;InputClaims&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;InputClaim&lt;/span&gt; &lt;span class="na"&gt;ClaimTypeReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"objectId"&lt;/span&gt; &lt;span class="na"&gt;TransformationClaimType=&lt;/span&gt;&lt;span class="s"&gt;"0.data.objectId"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;InputClaim&lt;/span&gt; &lt;span class="na"&gt;ClaimTypeReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"objectId"&lt;/span&gt; &lt;span class="na"&gt;TransformationClaimType=&lt;/span&gt;&lt;span class="s"&gt;"0.id"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;InputClaim&lt;/span&gt; &lt;span class="na"&gt;ClaimTypeReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"systemDateTime"&lt;/span&gt; &lt;span class="na"&gt;TransformationClaimType=&lt;/span&gt;&lt;span class="s"&gt;"0.eventTime"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/InputClaims&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;InputParameters&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;InputParameter&lt;/span&gt; &lt;span class="na"&gt;Id=&lt;/span&gt;&lt;span class="s"&gt;"0.dataVersion"&lt;/span&gt; &lt;span class="na"&gt;DataType=&lt;/span&gt;&lt;span class="s"&gt;"string"&lt;/span&gt; &lt;span class="na"&gt;Value=&lt;/span&gt;&lt;span class="s"&gt;"1.0"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;InputParameter&lt;/span&gt; &lt;span class="na"&gt;Id=&lt;/span&gt;&lt;span class="s"&gt;"0.eventType"&lt;/span&gt; &lt;span class="na"&gt;DataType=&lt;/span&gt;&lt;span class="s"&gt;"string"&lt;/span&gt; &lt;span class="na"&gt;Value=&lt;/span&gt;&lt;span class="s"&gt;"Microsoft.ActiveDirectory"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;InputParameter&lt;/span&gt; &lt;span class="na"&gt;Id=&lt;/span&gt;&lt;span class="s"&gt;"0.subject"&lt;/span&gt; &lt;span class="na"&gt;DataType=&lt;/span&gt;&lt;span class="s"&gt;"string"&lt;/span&gt; &lt;span class="na"&gt;Value=&lt;/span&gt;&lt;span class="s"&gt;"{Settings:Tenant}"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/InputParameters&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;OutputClaims&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;OutputClaim&lt;/span&gt; &lt;span class="na"&gt;ClaimTypeReferenceId=&lt;/span&gt;&lt;span class="s"&gt;"userRegisterEvent"&lt;/span&gt; &lt;span class="na"&gt;TransformationClaimType=&lt;/span&gt;&lt;span class="s"&gt;"outputClaim"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/OutputClaims&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/ClaimsTransformation&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;GenerateRegistrationEventRequest&lt;/code&gt; has instead the burden of constructing the JSON and enhancing the &lt;code&gt;userRegisterEvent&lt;/code&gt; claim.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions.
&lt;/h2&gt;

&lt;p&gt;In this article, we have seen how through &lt;em&gt;Identity Experience Framework&lt;/em&gt; it is possible to integrate a B2C tenant with our infrastructure and open possible interesting development scenarios.&lt;br&gt;&lt;br&gt;
To do this we touched on &lt;em&gt;Azure Event Grid&lt;/em&gt; and how to create an &lt;em&gt;Event Grid Topic&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Finally how you can &lt;a href="https://docs.microsoft.com/azure/active-directory-b2c/claimstransformations#claims-transformations-reference"&gt;manipulate attestations&lt;/a&gt; and use them within &lt;a href="https://docs.microsoft.com/azure/active-directory-b2c/technicalprofiles"&gt;&lt;em&gt;technical profiles&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you are interested in the complete example you can find it at &lt;a href="https://github.com/binick/samples/tree/master/src/enrich-a-jwt-token-with-ief"&gt;https://github.com/binick/samples/tree/master/src/enrich-a-jwt-token-with-ief&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>activedirectory</category>
    </item>
    <item>
      <title>How to include code coverage in Azure DevOps pipeline?</title>
      <dc:creator>Nicola Biancolini</dc:creator>
      <pubDate>Sat, 16 Jan 2021 19:20:32 +0000</pubDate>
      <link>https://dev.to/binick/how-to-include-code-coverage-in-azure-devops-pipeline-1994</link>
      <guid>https://dev.to/binick/how-to-include-code-coverage-in-azure-devops-pipeline-1994</guid>
      <description>&lt;p&gt;By code coverage we mean the action of trying to measure how much of our code has been executed by our tests.&lt;br&gt;
This sound like &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Untested code is a broken code.&lt;br&gt;
Definitely a strong statement but true in a way, we don't always manage to get enough coverage.&lt;br&gt;
Often this happens because we don't have time, other times because despite having written tests we are not able to read the metrics. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, how we can "humanize" code coverage metrics? And how we can generate its?&lt;/p&gt;

&lt;p&gt;To answer at these questions I usually use two libraries.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/coverlet-coverage"&gt;
        coverlet-coverage
      &lt;/a&gt; / &lt;a href="https://github.com/coverlet-coverage/coverlet"&gt;
        coverlet
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Cross platform code coverage for .NET
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;to gather metrics, and&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/danielpalme"&gt;
        danielpalme
      &lt;/a&gt; / &lt;a href="https://github.com/danielpalme/ReportGenerator"&gt;
        ReportGenerator
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;for generate human-readable reports.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can set-up &lt;strong&gt;&lt;em&gt;coverlet&lt;/em&gt;&lt;/strong&gt;?
&lt;/h2&gt;

&lt;p&gt;I usually include &lt;a href="https://www.nuget.org/packages/coverlet.msbuild/"&gt;coverlet.msbuild&lt;/a&gt; by &lt;a href="https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-dot-targets-files"&gt;MSBuild .targets Files - Visual Studio | Microsoft Docs&lt;/a&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;For alternative ways to include &lt;em&gt;coverlet&lt;/em&gt; into yout test project see also &lt;a href="https://github.com/coverlet-coverage/coverlet#Quick-Start"&gt;coverlet-coverage/coverlet: Cross platform code coverage for .NET (github.com)&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can set-up &lt;strong&gt;&lt;em&gt;ReportGenerator&lt;/em&gt;&lt;/strong&gt;?
&lt;/h2&gt;

&lt;p&gt;In keeping with above to include &lt;a href="https://www.nuget.org/packages/ReportGenerator"&gt;ReportGenerator&lt;/a&gt; by &lt;a href="https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-dot-targets-files"&gt;MSBuild .targets Files - Visual Studio | Microsoft Docs&lt;/a&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Also this tool offer a various way to use it, you can find all ways onto official documentation &lt;a href="https://danielpalme.github.io/ReportGenerator/"&gt;ReportGenerator - converts coverage reports generated by coverlet&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to wire-up all that?
&lt;/h2&gt;

&lt;p&gt;To make everything work we need to add another &lt;em&gt;MSBuild&lt;/em&gt; file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And include this into your test project, something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Project&lt;/span&gt; &lt;span class="na"&gt;Sdk=&lt;/span&gt;&lt;span class="s"&gt;"Microsoft.NET.Sdk"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;PropertyGroup&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;TargetFramework&amp;gt;&lt;/span&gt;net5.0&lt;span class="nt"&gt;&amp;lt;/TargetFramework&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/PropertyGroup&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;Import&lt;/span&gt; &lt;span class="na"&gt;Project=&lt;/span&gt;&lt;span class="s"&gt;"Tests.targets"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;

&lt;span class="nt"&gt;&amp;lt;/Project&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now everything you are able to run &lt;code&gt;dotnet test&lt;/code&gt; you will able to inspect and analyze something like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://camo.githubusercontent.com/adbd81e4a37adb003d75ecc13d508acda0c7aebc/68747470733a2f2f64616e69656c70616c6d652e6769746875622e696f2f5265706f727447656e657261746f722f7265736f75726365732f73637265656e73686f74312e706e67" class="article-body-image-wrapper"&gt;&lt;img src="https://camo.githubusercontent.com/adbd81e4a37adb003d75ecc13d508acda0c7aebc/68747470733a2f2f64616e69656c70616c6d652e6769746875622e696f2f5265706f727447656e657261746f722f7265736f75726365732f73637265656e73686f74312e706e67" alt="coverage-report)" width="999" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://camo.githubusercontent.com/05adffdf7d564ad20b92b174c47353a26337ecdc58887d0c64a3b4e633e8770a/68747470733a2f2f64616e69656c70616c6d652e6769746875622e696f2f5265706f727447656e657261746f722f7265736f75726365732f73637265656e73686f74322e706e67" class="article-body-image-wrapper"&gt;&lt;img src="https://camo.githubusercontent.com/05adffdf7d564ad20b92b174c47353a26337ecdc58887d0c64a3b4e633e8770a/68747470733a2f2f64616e69656c70616c6d652e6769746875622e696f2f5265706f727447656e657261746f722f7265736f75726365732f73637265656e73686f74322e706e67" alt="coverage-report-detail" width="888" height="616"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think that is an amazing tool to understand at a glance which codes are covered and which not.&lt;/p&gt;
&lt;h2&gt;
  
  
  And now, how I can put it into Azure DevOps pipeline?
&lt;/h2&gt;

&lt;p&gt;It would be nice if this report came was published into the &lt;em&gt;Build pipeline&lt;/em&gt; report, don't you think? Maybe even include branch policies for it.&lt;/p&gt;

&lt;p&gt;Well that's possible by use &lt;a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/test/publish-code-coverage-results"&gt;Publish Code Coverage Results task&lt;/a&gt;, something like this:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PublishCodeCoverageResults@1&lt;/span&gt;
  &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Publish Code Coverage Results&lt;/span&gt;
  &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;codeCoverageTool&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;cobertura'&lt;/span&gt;
    &lt;span class="na"&gt;summaryFileLocation&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)/Reports/Summary/Cobertura.xml'&lt;/span&gt;
    &lt;span class="na"&gt;continueOnError&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;always()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We notice the &lt;code&gt;summaryFileLocation&lt;/code&gt; argument, this means that we will push only one file to &lt;em&gt;Azure DevOps&lt;/em&gt; why?&lt;/p&gt;

&lt;p&gt;One unwrite note of &lt;em&gt;Publish Code Coverage Results task&lt;/em&gt; or limitation, I don't know, is that the sum of covered lines, when we publish more reports, is take from the first file &lt;a href="/contents/pipeline-run-summary.png" class="article-body-image-wrapper"&gt;&lt;img src="/contents/pipeline-run-summary.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This results in an unreliable result.&lt;/p&gt;

&lt;p&gt;To fix that problem we can marge multiple reports into a summary reports so that can be publish it only one. One way to make it is the follow&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;and run &lt;em&gt;MSBuild&lt;/em&gt; project into the pipeline with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dotnet msbuild SummaryReportGenerator.proj /p:Configuration=$(Configuration)&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;GenerateCodeCoverageSummary&lt;/span&gt;
  &lt;span class="na"&gt;displayName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Generate code coverage summary&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you've done this the sum of covered lines on &lt;em&gt;Build pipeline&lt;/em&gt; will true.&lt;/p&gt;

</description>
      <category>codecoverage</category>
      <category>dotnet</category>
      <category>tutorial</category>
      <category>devops</category>
    </item>
    <item>
      <title>SqlServer, EFCore, JSON 👀</title>
      <dc:creator>Nicola Biancolini</dc:creator>
      <pubDate>Thu, 22 Oct 2020 18:10:35 +0000</pubDate>
      <link>https://dev.to/binick/sqlserver-efcore-json-3l16</link>
      <guid>https://dev.to/binick/sqlserver-efcore-json-3l16</guid>
      <description>&lt;p&gt;Sometimes we have been forced to work with json stored on table columns, it will have happened to you too!.&lt;/p&gt;

&lt;p&gt;In this post I want to show you how work with that using &lt;strong&gt;EntityFramework Core&lt;/strong&gt; &lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/dotnet"&gt;
        dotnet
      &lt;/a&gt; / &lt;a href="https://github.com/dotnet/efcore"&gt;
        efcore
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Clearly this is one of many possible ways.&lt;/p&gt;

&lt;p&gt;We could talk for a long time about the choice to store JSON into RDBMS is a good or bad choice, but the intent of this post isn't make rant.&lt;/p&gt;

&lt;p&gt;Ok, well. First of all take a look to JSON that we want to persist into table column&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Our application has a requirement that makes it necessary to query the database with the name of the retailer that has stored in the JSON.&lt;/p&gt;

&lt;p&gt;The retailer is the one who has the car we want to rent.&lt;br&gt;
The car is represented by the class&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The Car entity has a property &lt;code&gt;public string NameOfRetailer { get; }&lt;/code&gt; that is computed by the &lt;a href="https://docs.microsoft.com/en-us/ef/core/modeling/generated-properties?tabs=data-annotations#computed-columns"&gt;Computed columns&lt;/a&gt; functionality.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;With this instruction &lt;strong&gt;efcore&lt;/strong&gt; will inflate property with value returned by &lt;code&gt;JSON_VALUE(Metadata, '$.Retailer.Name')&lt;/code&gt; expression, for more information about &lt;code&gt;JSON_VALUE&lt;/code&gt; see at &lt;a href="https://docs.microsoft.com/en-us/sql/t-sql/functions/json-value-transact-sql?view=sql-server-ver15"&gt;JSON_VALUE&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To make it work, we need to persist the JSON into table column &lt;code&gt;Metadata&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We can use the other usefull &lt;a href="https://docs.microsoft.com/en-us/ef/core/modeling/value-conversions"&gt;Value conversions&lt;/a&gt; functionality of &lt;strong&gt;efcore&lt;/strong&gt;.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
 


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Now, after that model configurations we are able to resolve this simple query &lt;code&gt;var car = await context.Cars.MaterializeAsync(car =&amp;gt; car.NameOfRetailer == "Car Auto Orvieto").ConfigureAwait(false);&lt;/code&gt; without materialize the entire dataset on the client. 🚀&lt;/p&gt;

&lt;p&gt;If you want to learn more you can find the sample on my github repo &lt;a href="https://github.com/binick/samples/blob/6b9a4676c4f7f243c73abd59fb6aec592fd9f543/src/ef-core-json"&gt;ef-core-json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding!🐱‍👤&lt;/p&gt;

</description>
      <category>efcore</category>
      <category>sqlserver</category>
      <category>json</category>
      <category>dotnet</category>
    </item>
  </channel>
</rss>
