0 Comments

The challenge in the past is that every time you are developing a new webapp or bot which requires authentication you will go through all the steps i.e. creating service principle, grant permissions, set credentials, store credentials on resources, rotate credentials, and etc..   Now there is a better solution: Managed identities for Azure resources.


One of the examples where you can adopt the managed identities when you want to build an application using web application that accesses Azure blob storage without having to manage any credentials.


How to create

Managed identities is using service principle under the hook. Once you created the user assigned identity in Azure portal the same way as you creating other Azure resources,  you can now going to the target resources i..e blob storage and assign the permission i.e. contributor role to the user assigned identity you just created.   Now, last step is to go to the Azure resource where you want to access the target blob storage, i.e. azure function, and in Identity blade, you can add the user assigned identity that you just have created.


Below is the example demonstrates authenticating the BlobClient from the Azure.Storage.Blobs client library using the DefaultAzureCredential with a user assigned managed identity configured.

DefaultAzureCredential discovery mechanism allows you to run the code with your signed in account when you are using the code locally and automatically switching to use the user assigned identity when the code is deployed in azure. Please be noted that your local account will require to have the same permission as the user assigned identity in Azure.

Managed identities for Azure resources provide Azure services with an automatically managed identity in Azure Active Directory. Using a managed identity, you can authenticate to any service that supports Azure AD authentication without managing credentials. You can find the list of available services here.

0 Comments

image

Sitecore marketing automation provides a way to create automated online campaigns in Sitecore. A marketing automation campaign is a plan that allows you to determine how to interact with contacts based on their interaction behavior with the website. 

The marketing automation is powerful, yet there are some challenges as stated below when you want to leverage for supporting the business.   This article is to share my experience how to extend Sitecore marketing automation to fit your business goals and overcome these challenges.   


Challenges

Only support MVC applications, unless you purchase JSS license

With the out-of-box Sitecore marketing automation, it supports MVC application natively. However, you may want to leverage marketing automation with your single page app (SPAs)i.e. ReactJS, Angular applications etc. via APIs.


Tracking specific user behaviours

In addition, the out-of-the-box supports events like page view events , what if you want to track specific user actions i.e. tracking whom make quote on your website.


Business requirements

Before discussing the solution, let’s have a look what business wants to achieve.

One day morning, business came to me and ask if there is anyway we can get our customers more engaged than ever before? like sending them a reminder when they made a quote on our website.


Technical requirements

Engagement plan

Based on the business requirements, the first thing on top of my head is Sitecore marketing automation engagement plan. Someone makes a quote can be a goal that a user achieved on the website. Once they triggered a goal, we can send them a reminder email.  Obviously, we need another goal when a user finalized the quote, as we don’t want to keep sending them reminders. 


Sitecore Services API

We have engagement plan, now how are we going to trigger a goal? our site is not MVC application, it’s a single page application.  Thus, tracking is not natively enabled. You can use MVC controller, however, why I decided to implement Sitecore services API is because that it has dependency injection enabled, and security enforced.  


EXM email template and custom token

A company branded email template is required. What else? The ultimate goal of the reminder email is to encourage user to finalize the quote by purchasing the service.  Adding a hyperlink i.e. “click here to complete your purchase” seems a good idea for increasing the conversion rate.  Thus, we will need quote no. which will be a custom token.


Solution

Cool, now we know what business wants to achieve and what’s required from technical point of view. 


1. Let’s start with creating goals

  • Make a quote  - when user make a quote on the website.
  • Complete a quote – when user completed the payment


2. I also created custom events

This allows to store custom values i.e. quote Id which can be retrieved with custom token in EXM

  • Make quote event
  • Complete quote event


3. Next, design a user journey

engagement plan


4. Creating Service APIs

There are a few things you will need to consider

  • Session
  • Authentication
  • Dependency Injection


Session

Services API by default doesn’t support session. most likely you will get Analytics.Tracking is null error.  Thus,  you will need to add session handler to your router.

image


Authentication

The good news is you can leverage Sitecore built-in Services API authentication for your custom controller.  you can find more details on how to authenticate your user here.  I would suggest to create specific user for your application.


Dependency Injection

Dependency injection allows you to loose coupling your code. Rather than instantiating objects directly in the code, often classes will declare their dependencies through constructor.    Sitecore services API allows you configure your injection in configuration. you can find more details here.

<configuration>
    <sitecore>
        <services>
            <register serviceType="IMyService, MyAbstraction.Assembly" implementationType="MyServiceImplementation, MyImplementation.Assembly" />
            <register serviceType="MyServiceBase, MyAbstraction.Assembly" implementationType="MyServiceBaseImplementation, MyImplementation.Assembly" />
        </services>
    </sitecore>
</configuration>


Implement Triggering a goal

Cool, by now if you are following the above steps you should have your API up and running with authentication enabled.  next is to create action for triggering the goal.


Identify contact

In my case, I need to identify the contact and update their information. IdentifyAs is the method I’m using. This basically tells sitecore that If it doesn’t exist then creating a new contact, otherwise makes it as known contact.

image


update contact

After contact is created, next is to update the contact details i.e. addressList,

For updating contact, I’m using xConnect Client API.  Sitecore xConnect client API allows trusted clients to create, read, update, and search contacts and interactions over HTTPs.  you can find more details here.


Don’t forget to extend the facets you want to update, as by default, sitecore doesn’t return most of the facets. Here is an example of extending facets.

image


triggering goal

It is a bit misleading about triggering a goal in Sitecore documentation. It states to register a goal for triggering it. Unfortunately, it won’t work with API, as it doesn’t have page context.

var goalId = Guid.NewGuid(); // ID of goal
var goalDefinition = Sitecore.Analytics.Tracker.MarketingDefinitions.Goals[goalId];

Sitecore.Analytics.Tracker.Current.CurrentPage.RegisterGoal(goalDefinition);

Instead, I’ll still need to use xConnect Client API. Goal is specific type of an interaction. so you can add an interaction with a type of xConnect Goal

image

Once you added the goal, you are able to validate in the experience profile as shown below.

image


Awesome, by now we have our goal triggered. we can start configure our engagement plan.  based on the business requirements,  I have created 3 reminders as shown below. 

When users trigger “make a quote” goal, they will be engaged into the campaign, during the period, if they never complete their purchase, 3 reminders will be sent to them.


image

Here is my testing results:

I triggered two goals with different quote Id. Since I never completed the purchase, I have received 3 reminders for each of the quote.

image


Summary

Hooray!  Now, the custom API extends Sitecore tracking capabilities to our SPAs and mobile apps.  As you can seen that Sky is the limit for using Sitecore Marketing Automation to achieve your business goals.   I hope you enjoyed this article.

0 Comments

If you are learning AZ-303, and changes are you will encounter the same error when following the Exercise – Create an NVA and virtual machines (unit 5-7) by the time i’m writing this document (11/07/2021).


I have reported this issue with the Exercise, but it might not be fixed anytime soon.  so just in case you need help with completing your Exercise. I tried to document the issue in Exercise, and the solution how you can resolve them.

 image

What’s the issue

The requirement is to create vnent with 3 subnets

  • 10.0.0.0/24
  • 10.0.1.0/24
  • 10.0.2.0/24

image


in Unit 5 of 7 , it provides the code as below for creating the 1st VM in subnet dmzsubnet.  The problem with the below command is it doesn’t specify the subnet address prefix, therefor by default, it will be 10.0.0.24.  You won’t yet get any error at this stage, as it’s the first subnet. Although it’s already not matching the design.

image

You will then get an error when you are following the Exercise along the way in Unit 6 of 7 with below code.  you can’t create subnet with conflict address.

image

What’s the Solution

Adding  “--subnet-address-prefix” when you create VMs. There are more optional parameters for creating VM you can find here.

here is the example code you can use

az vm create \
     --resource-group learn-4bd2e66c-7759-446c-9a49-071b27237a7f \
     --name public \
     --vnet-name vnet \
     --subnet publicsubnet \
     --image UbuntuLTS \
     --admin-username azureuser \
     --no-wait \
     --custom-data cloud-init.txt \
     --subnet-address-prefix 10.0.2.0/24 \
     --admin-password <changeme123>


0 Comments

image

Sitecore introduced new installation tool (SIA) for installing vanilla package. As part of this post, I will install the Sitecore new release 9.3 with SIA step by step.

Step 1: download 9.3 package

download Sitecore 9.3 from here https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/93/Sitecore_Experience_Platform_93_Initial_Release.aspx

Step 2:  place Sitecore licence under the root installation folder

i.e. C:\Installation\Sitecore 9.3.0 rev. 003498 (Setup XP0 Developer Workstation rev. 1.1.0-r105)

Step 3:  Update SIA installation configuration(setup.exe.config)

  • SQL Server name
  • SQL Server username/Password
  • SOLR URL
  • SOLR root
  • Solr Serverice
  • Solr Port

Please note the out-of-box configuration doesn’t not support zookeeper. if you are using Solr could with zookeeper, you will need to configure your own.

Step 4:  Install Sitecore

  • Install prerequisites

1

  • Install Solr

I have multiple versions of Sitecore instances, so I changed the default port to 8986

2

3

4

  • Install Sitecore and database

5

Once it completed, you should see the success message.

9

0 Comments

More and more organizations are moving into Headless and Microservice architecture space.  When talking about Headless, what’s the first thing on top of your head?  Yes, that’s right! Single page application (SPA).  The most popular front-end frameworks for a SPA are ReactJS, Angular and Vue etc.  Sitecore saw the trends and introduced JSS when Sitecore 9 is released.  In this article , I’m going to show you how to leverage JSS to build you organization components library that can be reused crossing all projects.

What’s JSS

Sitecore JavaScript Services (JSS) is a complete SDK for JavaScript developers that enables you to build full-fledged solutions using Sitecore and modern JavaScript UI libraries and frameworks.  Use your favourite JavaScript framework. Here is the JSS official documentation, if you want to know more.

Get Started

In order to build a JSS component library that can be reused by other teams, you will need to create npm module. If you don’t know what’s npm module, please read the official document here.

The sample component I’m going to build contains an Image, title and description as shown below

image

Create component library

Here is the code example of the sample component1.

The component1inherits from JSS components Text, Image, RichText.

image

To make it simple here, I didn’t customize the styling. In my next JSS post will show you how to create theme.

Once you complete the component1, you can publish into npm.

Follow the below steps for publishing the npm module

  • create package.json in which you will need to add devDependencies and peerDependencies.
  • installing babel and config the babel.config.js
  • npm install --save-dev @babel/core @babel/cli @babel/preset-env @babel/preset-react
  • Last is to include dist folder
  • "files": [
        "dist/*"
    ],

Now, you library is ready to be used for your projects.

image

Next step I’m going to show you how to use the library in the project.

Using the component library

Install the library you just created in your project with the below commend.

npm i qbe-jss-library

Once it is installed, the component can be used either in a page directly or be used to create a custom variation.  Lets say you want to add a <h2> on top of the sample component1component. 

Noticed instead of importing JSS library. I’m importing the custom library i.e. qbe-jss-library, and passing the value to the component1 .

image

Done! 

run mpn start

image

As you can see here,  the custom library can be easily imported into project and reused by different team. The benefits are obvious

  • High Reusability
  • High maintainability
  • High Consistency

Hope you enjoyed reading my article. Please feel free to leave your message, if you have any questions.