<?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: Danish Naglekar</title>
    <description>The latest articles on DEV Community by Danish Naglekar (@powermaverick).</description>
    <link>https://dev.to/powermaverick</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%2F431968%2F878a6be8-dbd7-405e-8a59-2150d8812d57.png</url>
      <title>DEV Community: Danish Naglekar</title>
      <link>https://dev.to/powermaverick</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/powermaverick"/>
    <language>en</language>
    <item>
      <title>PVA: Let chatbot start the conversation</title>
      <dc:creator>Danish Naglekar</dc:creator>
      <pubDate>Thu, 28 Jan 2021 11:00:00 +0000</pubDate>
      <link>https://dev.to/powermaverick/pva-let-chatbot-start-the-conversation-352n</link>
      <guid>https://dev.to/powermaverick/pva-let-chatbot-start-the-conversation-352n</guid>
      <description>&lt;p&gt;In past we have seen &lt;a href="https://powermaverick.dev/2020/04/08/add-styling-to-your-chat-bot/"&gt;how we can embed chatbots on a Power Apps portals or a web page using client-side code and custom styling&lt;/a&gt;. We also looked at how to &lt;a href="https://dev.to/powermaverick/add-chat-bot-on-wordpress-site-2m5m-temp-slug-5948025"&gt;add a chatbot on a WordPress site&lt;/a&gt; but all of these bots were created where the chatbot did not initiate the conversation but instead will wait for the users to initiate the conversation. This quickly becomes awkward for the users as they are not aware what to ask the bot and some help from the bot can go long way. This is where letting the bot start the conversation like “ &lt;strong&gt;Hi, I am bot. I can help answering your question regarding ###&lt;/strong&gt; ” will provide directions to the user and have an interactive conversation which will feel natural.&lt;/p&gt;

&lt;p&gt;As it has been a while I did not worked with Power Virtual Agent I didn’t get a chance to try out the improvements that was announced back in September, 2020 where we can use a custom code that can enable the bot to initiate the conversation. Link to the Microsoft documentation is &lt;a href="https://docs.microsoft.com/en-us/power-virtual-agents/configure-bot-greeting?WT.mc_id=BA-MVP-5003877"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this post we are going to utilize a single page application where we will add our chatbot. First thing we will do is add a button inside our &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; tag that will resemble like a chat icon and upon clicking this button the chatbot will be surfaced. The following is the snippet for adding that button:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;lt;button onclick="openChat()" role="openchatbutton" class="open-button"&amp;gt;
    &amp;lt;i class="fa fa-4x fa-comments"&amp;gt;&amp;lt;/i&amp;gt;
&amp;lt;/button&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we need to prepare the UI so that we can embed the chatbot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;lt;div role="openchat" id="chatWindow" class="chat-popup"
    style="order: 3; position: relative; width: 400px; min-width: 400px; height: 100%;"&amp;gt;
    &amp;lt;div id="webchat-wrapper"&amp;gt;
        &amp;lt;div id="webchat-header"&amp;gt;Talk to TAB!!&amp;lt;/div&amp;gt;
        &amp;lt;div id="webchat" role="main" id="webchat"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have added the code but without style that won’t appear correctly, so let us add some styling to make sure position, visibility and UX is appropriate with the website design. The following styling needs to be added to your &lt;code&gt;.css&lt;/code&gt; file and is only for demo purpose so feel free to change or experiment with it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
#webchat-wrapper {
  position: fixed;
  height: calc(100% - 230px);
  z-index: 9999;
  width: 400px;
  top: 140px;
  right: 30px;
  overflow: hidden;
}
#webchat {
  height: 90%;
}
#webchat-header {
  border-radius: 15px 15px 0px 0px;
  background: #f2f2f2;
  padding: 20px;
}
.chat-popup {
  display: none;
}
.open-button {
  background-color: transparent;
  color: white;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
} 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similar to the process we used in &lt;a href="https://powermaverick.dev/2020/04/08/add-styling-to-your-chat-bot/"&gt;my previous post&lt;/a&gt; we will be adding styling to the bot UI itself with the following css:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
div[role="form"] {
  background: rgba(255,255,255,0.6);
}  
div[role="status"] {
  border-bottom: 1px solid rgb(230, 230, 230);
} 
div[role="status"] button {
  border-color: rgb(0, 0,0,0.4) !important;
  color: rgb(0, 0, 0) !important;
} 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we have completed the design process and we need to add a logic to embed and invoke the chatbot. This is done using the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;lt;script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;script&amp;gt;
const styleOptions = {

    // Add styleOptions to customize Web Chat canvas
    hideUploadButton: true,
    botAvatarInitials: 'TAB',
    userAvatarInitials: 'You',
    backgroundColor: 'rgba(255,255,255,0.85)'
};

// Add your BOT ID below 
var BOT_ID = "YOUR-BOT-ID-NEEDS-TO-GO-HERE";
var theURL = "https://powerva.microsoft.com/api/botmanagement/v1/directline/directlinetoken?botId=" + BOT_ID;

const store = window.WebChat.createStore(
    {},
    ({ dispatch }) =&amp;gt; next =&amp;gt; action =&amp;gt; {
        if (action.type === "DIRECT_LINE/CONNECT_FULFILLED") {
            dispatch({
                meta: {
                    method: "keyboard",
                },
                payload: {
                    activity: {
                            channelData: {
                                postBack: true,
                            },
                            //Web Chat will show the 'Greeting' System Topic message which has a trigger-phrase 'hello'
                            name: 'startConversation',
                            type: "event"
                        },
                },
                type: "DIRECT_LINE/POST_ACTIVITY",
            });
        }
        return next(action);
    }
);

fetch(theURL)
    .then(response =&amp;gt; response.json())
    .then(conversationInfo =&amp;gt; {
        window.WebChat.renderWebChat(
            {
                directLine: window.WebChat.createDirectLine({
                    token: conversationInfo.token,
                }),
                store: store,
                styleOptions
            },
            document.getElementById('webchat')
        );
    })
    .catch(err =&amp;gt; console.error("An error occurred: " + err));
&amp;lt;/script&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see from the highlighted code, we instantiated a variable to hold &lt;code&gt;window.WebChat.createStore&lt;/code&gt; method which is then supplied to &lt;code&gt;window.WebChat.renderWebChat&lt;/code&gt; method as one of the parameter. This piece of code enables the bot to start the conversation using the &lt;strong&gt;Greetings&lt;/strong&gt; which is a system topic. If you wish to change the message that gets displayed when the bot loads you can change the messages in the &lt;strong&gt;Greetings&lt;/strong&gt; system topic.&lt;/p&gt;

&lt;p&gt;Now, the button we added is to show or hide the bot so it is not in the way of the user browsing your website. So initially, the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; that holds the UI for bot is hidden and click of the button shows the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; that has the bot. This is accomplished by the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;lt;script&amp;gt;
    function openChat() {
        var chatWindowElement = document.getElementById("chatWindow");
        if (window.getComputedStyle(chatWindowElement).display === "none") {
            document.getElementById("chatWindow").style.display = "block";
        } else {
            document.getElementById("chatWindow").style.display = "none";
        }
    }
&amp;lt;/script&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have all the pieces tied together you should have a working chatbot on your website. Below is the demo video of how the bot renders and works when embedded on this &lt;a href="http://pvademo.azurewebsites.net/"&gt;demo website&lt;/a&gt;:&lt;/p&gt;



&lt;p&gt;Hope this helps.&lt;/p&gt;

&lt;p&gt;Don’t forget to subscribe to my &lt;a href="https://www.powerplatformdevelopersweekly.com/"&gt;Power Platform Dev Newsletter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>powerplatform</category>
      <category>powervirtualagent</category>
      <category>chatbots</category>
      <category>conversations</category>
    </item>
    <item>
      <title>Efficiently use SVG animations in canvas apps</title>
      <dc:creator>Danish Naglekar</dc:creator>
      <pubDate>Mon, 23 Nov 2020 14:54:42 +0000</pubDate>
      <link>https://dev.to/powermaverick/efficiently-use-svg-animations-in-canvas-apps-1kjc</link>
      <guid>https://dev.to/powermaverick/efficiently-use-svg-animations-in-canvas-apps-1kjc</guid>
      <description>&lt;p&gt;I was looking at easy way to create animations in canvas apps; as I have seen so many community members have been creating beautiful apps using animations. But I didn’t want to spend too much time animating but deliver quick value to the users by building something that not only gets the job done but also looks good.&lt;/p&gt;

&lt;p&gt;I had seen some post which were focused on just one svg images but none of those images fit my use case. I wanted to find a process to use any svg image, tweak it to my liking and get it done. As said earlier, I did not want to spend a day creating animation. I even went down a path of learning to animate svg; though it was cool but was time-consuming.&lt;/p&gt;

&lt;p&gt;Then I found an easy way.&lt;/p&gt;

&lt;p&gt;First download any svg image you would want to use. I normally go to &lt;a href="https://icons8.com"&gt;https://icons8.com&lt;/a&gt; or &lt;a href="https://www.iconfinder.com"&gt;https://www.iconfinder.com&lt;/a&gt; search for the icon that would fit my use case and look for svg images only. Once you have found the right svg image; download it locally. Then comes the fun part – animating it. For that I stumbled upon a nice svg animator website called &lt;a href="https://app.svgator.com"&gt;https://app.svgator.com&lt;/a&gt;. Sign up for this website and it will guide you through the tour of the website. Read &lt;a href="https://www.smashingmagazine.com/2018/07/animating-svg-files-svgator/"&gt;this blog&lt;/a&gt; on more details on how to use SVGator. But I will show you a quick demo as well.&lt;/p&gt;

&lt;p&gt;I am using the the below image for animating in this example. As I cannot upload svg image here but if you want to get the similar image you can follow this &lt;a href="https://www.iconfinder.com/icons/2199094/settings_gear_options_preferences_setup_icon"&gt;link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/11/svg-image-for-animating.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ewvvwsr4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/11/svg-image-for-animating.png%3Fw%3D901" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you have the image, head over to SVGator and click on New Project. It will then ask you to upload your SVG file. Now, select the part of the image that you want to animate. Below that is a timeline control; and there you will find “Add animation” button. Clicking that will show you all the animations available for the type of part you have selected. In this case when you select path you get lot of animation properties. We will select “Rotate”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/11/svgator-select-animation.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GmhVJKSF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/11/svgator-select-animation.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now a keyframe will be added to the timeline. Put your timeline indicator at 3 sec. mark; right click and duplicate the keyframe. Edit “Rotate” under Transform section on the right-hand panel as shown in the following image:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/11/svgator-animate.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H5H2Zk_G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/11/svgator-animate.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once done you can run the animation by using the play button at the top bar next to you profile icon. This will result in the following animated image:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/11/svgator-animation-demo.gif"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UkpgZpMD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/11/svgator-animation-demo.gif%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using the Export button; you can export it in CSS that will download the svg file. Copy the contents of that svg file on an &lt;strong&gt;image&lt;/strong&gt; property of an image component in canvas app using the following format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
"data:image/svg+xml,"&amp;amp;EncodeUrl("&amp;lt;svg id='eclasfwtqu7q1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'
    viewBox='0 0 80 80' shape-rendering='geometricPrecision' text-rendering='geometricPrecision'&amp;gt;
    &amp;lt;style&amp;gt;
        &amp;lt;![CDATA[
        #eclasfwtqu7q4_tr {
            animation: eclasfwtqu7q4_tr__tr 3000ms linear 1 normal forwards
        }

        @keyframes eclasfwtqu7q4_tr__tr {
            0% {
                transform: translate(39.999999px, 39.950002px) rotate(0deg)
            }

            100% {
                transform: translate(39.999999px, 39.950002px) rotate(360deg)
            }
        }
        ]]&amp;gt;
    &amp;lt;/style&amp;gt;
    &amp;lt;g id='eclasfwtqu7q2'&amp;gt;
        &amp;lt;g id='eclasfwtqu7q3'&amp;gt;
            &amp;lt;g id='eclasfwtqu7q4_tr' transform='translate(39.999999,39.950002) rotate(0)'&amp;gt;
                &amp;lt;path id='eclasfwtqu7q4'
                    d='M64.700000,40C64.700000,39.700000,64.700000,39.400000,64.700000,39.100000L74.800000,35.800000L70.600000,23L60.500000,26.300000C60.200000,25.800000,59.800000,25.300000,59.400000,24.800000L65.700000,16.200000L54.800000,8.200000L48.500000,16.800000C47.900000,16.600000,47.300000,16.400000,46.700000,16.200000L46.700000,5.600000L33.300000,5.600000L33.300000,16.200000C32.700000,16.400000,32.100000,16.600000,31.500000,16.800000L25.200000,8.200000L14.300000,16.100000L20.600000,24.700000C20.200000,25.200000,19.900000,25.700000,19.500000,26.200000L9.400000,22.900000L5.200000,35.800000L15.300000,39.100000C15.300000,39.400000,15.300000,39.700000,15.300000,40C15.300000,40.300000,15.300000,40.600000,15.300000,40.900000L5.200000,44.200000L9.400000,57L19.500000,53.700000C19.800000,54.200000,20.200000,54.700000,20.600000,55.200000L14.300000,63.800000L25.200000,71.700000L31.500000,63.100000C32.100000,63.300000,32.700000,63.500000,33.300000,63.700000L33.300000,74.300000L46.800000,74.300000L46.800000,63.800000C47.400000,63.600000,48,63.400000,48.600000,63.200000L54.800000,71.800000L65.700000,63.900000L59.400000,55.300000C59.800000,54.800000,60.100000,54.300000,60.500000,53.800000L70.600000,57L74.800000,44.200000L64.700000,40.900000C64.700000,40.600000,64.700000,40.300000,64.700000,40ZM71,46.100000L68.700000,53.200000L59.200000,50.100000L58.600000,51.100000C58,52.200000,57.200000,53.200000,56.400000,54.100000L55.600000,55L61.500000,63.100000L55.400000,67.500000L49.500000,59.400000L48.500000,60C47.400000,60.500000,46.200000,60.900000,45,61.100000L43.800000,61.400000L43.800000,71.400000L36.300000,71.400000L36.300000,61.400000L35.100000,61.100000C33.900000,60.800000,32.700000,60.400000,31.600000,60L30.500000,59.500000L24.600000,67.600000L18.500000,63.200000L24.400000,55.100000L23.600000,54.200000C22.800000,53.300000,22.100000,52.300000,21.400000,51.200000L20.800000,50.200000L11.300000,53.300000L9,46.100000L18.500000,43L18.400000,41.800000C18.400000,41.200000,18.300000,40.600000,18.300000,39.900000C18.300000,39.200000,18.300000,38.600000,18.400000,38L18.500000,36.800000L9,33.900000L11.300000,26.800000L20.800000,29.900000L21.400000,28.900000C22,27.800000,22.800000,26.800000,23.600000,25.900000L24.400000,25L18.500000,16.900000L24.600000,12.500000L30.500000,20.600000L31.600000,20.100000C32.700000,19.600000,33.900000,19.200000,35.200000,19L36.400000,18.700000L36.400000,8.700000L43.900000,8.700000L43.900000,18.700000L45.100000,19C46.300000,19.300000,47.500000,19.700000,48.600000,20.100000L49.700000,20.600000L55.600000,12.500000L61.700000,16.900000L55.800000,25L56.600000,25.900000C57.400000,26.800000,58.100000,27.800000,58.800000,28.900000L59.400000,29.900000L68.900000,26.800000L71.200000,33.900000L61.700000,37L61.800000,38.200000C61.800000,38.800000,61.900000,39.400000,61.900000,40.100000C61.900000,40.800000,61.900000,41.400000,61.800000,42L61.500000,43L71,46.100000Z'
                    transform='translate(-39.999999,-39.950002)' fill='rgb(0,0,0)' stroke='none' stroke-width='1' /&amp;gt;
            &amp;lt;/g&amp;gt;
            &amp;lt;path id='eclasfwtqu7q5'
                d='M40,26.800000C32.700000,26.800000,26.800000,32.700000,26.800000,40C26.800000,47.300000,32.700000,53.200000,40,53.200000C47.300000,53.200000,53.200000,47.300000,53.200000,40C53.200000,32.700000,47.300000,26.800000,40,26.800000ZM40,50.200000C34.400000,50.200000,29.800000,45.600000,29.800000,40C29.800000,34.400000,34.400000,29.800000,40,29.800000C45.600000,29.800000,50.200000,34.400000,50.200000,40C50.200000,45.600000,45.600000,50.200000,40,50.200000Z'
                fill='rgb(0,0,0)' stroke='none' stroke-width='1' /&amp;gt;
        &amp;lt;/g&amp;gt;
    &amp;lt;/g&amp;gt;
&amp;lt;/svg&amp;gt;")

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After adding the code in canvas apps it would look like below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/11/canvas-app-animation-demo.gif"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2ZqdFQY_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/11/canvas-app-animation-demo.gif%3Fw%3D1024" alt=""&gt;&lt;/a&gt;Now, if you want the image to keep looping then you have to change one more property in SVGator. This is shown in the following screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/11/svgator-loop.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--REZhu_RQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/11/svgator-loop.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this helps you create some nice animations.&lt;/p&gt;

&lt;p&gt;Don’t forget to subscribe to my &lt;a href="https://www.powerplatformdevelopersweekly.com/"&gt;Power Platform Dev Newsletter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>canvasapp</category>
      <category>powerapps</category>
      <category>powerplatform</category>
      <category>animations</category>
    </item>
    <item>
      <title>Changing the owner of Canvas Apps &amp; Flows</title>
      <dc:creator>Danish Naglekar</dc:creator>
      <pubDate>Tue, 06 Oct 2020 10:00:00 +0000</pubDate>
      <link>https://dev.to/powermaverick/changing-the-owner-of-canvas-apps-flows-hjg</link>
      <guid>https://dev.to/powermaverick/changing-the-owner-of-canvas-apps-flows-hjg</guid>
      <description>&lt;p&gt;Your colleague created a Canvas Apps and bunch of Power Automate Flows; but then he/she left the organization without sharing the canvas app and flows. Even though you are a system admin you find out that you do not have rights to edit or share the canvas apps and flows owned by your colleague who left. Or if you were using ALM process using Power Platform Build Tools in Azure DevOps and the canvas app that was deployed is now owned by your DevOps Admin. Whatever the case – Worry not!! Power Apps have provided bunch of PowerShell scripts for us to work with.&lt;/p&gt;

&lt;h3&gt;
  
  
  Before we start
&lt;/h3&gt;

&lt;p&gt;First, we need to install the required Power Shell modules. So, open your &lt;strong&gt;Windows PowerShell ISE&lt;/strong&gt; in admin mode.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e7vYvggz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/10/changeowner-1-winps.png%3Fw%3D785" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e7vYvggz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/10/changeowner-1-winps.png%3Fw%3D785" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy, paste the below commands in the scripting area pf Windows PowerShell ISE to install the required Power Shell modules.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install-Module Microsoft.PowerApps.Administration.PowerShell -Force Install-Module Microsoft.PowerApps.PowerShell -Force -AllowClobber Install-Module -Name AzureAD -Force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the command by using the &lt;strong&gt;Run Script&lt;/strong&gt; button or pressing &lt;strong&gt;F5&lt;/strong&gt; on your keyboard.&lt;/p&gt;

&lt;h3&gt;
  
  
  Change owner of canvas app
&lt;/h3&gt;

&lt;p&gt;Once you have installed the required modules. Let us now look into the process of changing the owner of canvas app. To change the owner, you will need the App Id and Environment Id.&lt;/p&gt;

&lt;h4&gt;
  
  
  Getting the environment id
&lt;/h4&gt;

&lt;p&gt;To get the environment id you have to login to &lt;a href="https://make.powerapps.com/"&gt;make.powerapps.com&lt;/a&gt; and choose your environment from the environment selector option. Once the page loads with the environment you selected observe the URL. It will be something like: &lt;em&gt;&lt;a href="https://make.powerapps.com/environments/"&gt;https://make.powerapps.com/environments/&lt;/a&gt;12346be2-f047-1234-1234-abcd4d0c1234/home&lt;/em&gt;. The GUID after environment is your environment id. Copy and save this id as we will need it later.&lt;/p&gt;

&lt;h4&gt;
  
  
  Getting canvas app id
&lt;/h4&gt;

&lt;p&gt;Using the environment id, you retrieved above create a new script in Windows PowerShell ISE and copy, paste the below command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Add-PowerAppsAccount Get-AdminPowerApp –EnvironmentName '12346be2-f047-1234-1234-abcd4d0c1234'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the command using &lt;strong&gt;F5&lt;/strong&gt;. After the command fully executes you will see list of all the canvas apps created in this environment (as shown below). Find your app and copy the GUID of your app which is shown as AppName in the list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hlS0Kvo_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/10/changeowner-2-listofcanvasapps-1.png%3Fw%3D841" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hlS0Kvo_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/10/changeowner-2-listofcanvasapps-1.png%3Fw%3D841" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Canvas app Owner Change
&lt;/h4&gt;

&lt;p&gt;Now, time to change the owner. As this is an administrative operation you need to be either Global Admin or Dynamics 365 admin. For more information on permissions, read the &lt;a href="https://docs.microsoft.com/en-us/power-platform/admin/powerapps-powershell#prerequisite-1"&gt;official MS Docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Copy, paste the below command in a new script in Windows PowerShell ISE. This command will assign yourself as the owner of the app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Add-PowerAppsAccount Set-AdminPowerAppOwner –AppName '4321fda5-abcd-4321-12bd-1234898a4321' -AppOwner $Global:currentSession.userId –EnvironmentName '12346be2-f047-1234-1234-abcd4d0c1234'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to assign it to a user other than yourself then you need to use User’s Object Id from Azure. Execute the following command that will get the user id from Azure and add the provided user email address as the owner on the App:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Connect-AzureAD #Replace this with a correct email address $emailAddress = "user@demo.onmicrosoft.com"; $userID = Get-AzureADUser -ObjectID $emailAddress | Select-Object ObjectId Set-AdminPowerAppOwner –AppName '4321fda5-abcd-4321-12bd-1234898a4321' -AppOwner $userID.objectId –EnvironmentName '12346be2-f047-1234-1234-abcd4d0c1234'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Change the owner of Power Automate flow
&lt;/h3&gt;

&lt;p&gt;After owner of the app has been changed; time to now look at how to change the owner of the Flows. There could be multiple flows assigned to that user so you would want to loop through all the Flows that belong to that particular user and reassign them to you. Below code snippet will allow you to do that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Add-PowerAppsAccount Connect-AzureAD #Replace this with a correct email address $previousUserEmailAddress = "user@demo.onmicrosoft.com"; $previousUserID = Get-AzureADUser -ObjectID $emailAddress | Select-Object ObjectId Write-Host "Previous User Id: "$previousUserID.objectId #Replace this with your environment id $environmentName = '12346be2-f047-1234-1234-abcd4d0c1234' $flows = Get-AdminFlow –EnvironmentName $environmentName | Select-Object FlowName, DisplayName foreach($flow in $flows){ try{ $flowOwners = Get-AdminFlowOwnerRole –EnvironmentName $environmentName –FlowName $flow.FlowName | Select-Object PrincipalObjectId, RoleId foreach($flowOwner in $flowOwners){ Write-Host "Identifying: "$flow.DisplayName" | "$flow.FlowName if($flowOwner.PrincipalObjectId -eq $previousUserID.objectId){ Write-Host "Changing the owner" Set-AdminFlowOwnerRole -PrincipalType User -PrincipalObjectId $Global:currentSession.userId -RoleName CanEdit -FlowName $flow.FlowName -EnvironmentName $environmentName Remove-AdminFlowOwnerRole -RoleId $flowOwner.RoleId -FlowName $flow.FlowName -EnvironmentName $environmentName } Write-Host "---" } } catch [System.Exception]{ Write-Host $\_.Exception.Message } }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure to change the values on the highlighted rows above. And as we did for canvas app instead of using &lt;code&gt;$Global:currentSession.userId&lt;/code&gt; you can use any user’s object id from Azure.&lt;/p&gt;

&lt;p&gt;Hope this helps.&lt;/p&gt;

&lt;p&gt;Don’t forget to subscribe to my &lt;a href="https://www.powerplatformdevelopersweekly.com/"&gt;Power Platform Dev Newsletter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>canvasapp</category>
      <category>powerapps</category>
      <category>powerautomate</category>
      <category>powerplatform</category>
    </item>
    <item>
      <title>Add Power Virtual Agent Chat Bot on WordPress site</title>
      <dc:creator>Danish Naglekar</dc:creator>
      <pubDate>Wed, 02 Sep 2020 15:52:54 +0000</pubDate>
      <link>https://dev.to/powermaverick/add-power-virtual-agent-chat-bot-on-wordpress-site-44gl</link>
      <guid>https://dev.to/powermaverick/add-power-virtual-agent-chat-bot-on-wordpress-site-44gl</guid>
      <description>&lt;p&gt;In my &lt;a href="https://powermaverick.dev/2020/04/08/add-styling-to-your-chat-bot/"&gt;&lt;strong&gt;previous post&lt;/strong&gt;&lt;/a&gt; I have explained how to style you chat bot when adding it on custom website or portals. But I always wondered can I add chat bot on a WordPress site, and I was able to find the answer to that question. So, let us see how we can achieve that. In this post I am only showing how to add bot to a WordPress site. To understand the styling refer to my &lt;a href="https://powermaverick.dev/2020/04/08/add-styling-to-your-chat-bot/"&gt;previous post&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Before we begun, build your bot using &lt;a href="https://powerva.microsoft.com/"&gt;&lt;strong&gt;Power Virtual Agent&lt;/strong&gt;&lt;/a&gt;; also ensure that you either have managed WordPress or if you are using WordPress.com then you need Business Plan or above. Next you need to install &lt;a href="https://wordpress.org/plugins/header-and-footer-scripts-inserter/"&gt;&lt;strong&gt;Head and Footer Scripts Inserter&lt;/strong&gt;&lt;/a&gt; plugin. Once you have these prerequisites then you can move forward. I will be using a managed WordPress site to do my changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Construct your page
&lt;/h3&gt;

&lt;p&gt;You can pick an existing page but before you do this I would recommend to add a new page so you can test your bot before adding the code on your existing page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/09/addpage.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GDE2DQ0w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/09/addpage.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you add a page application will navigate you to the page editor. On this editor switch from &lt;strong&gt;Visual Editor&lt;/strong&gt; to &lt;strong&gt;Code Editor&lt;/strong&gt; (as shown below). Add the code provided below, and publish/update the page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/09/02_addcodeonpage.gif"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fGLwB9_X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/09/02_addcodeonpage.gif%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Chat Bot --&amp;gt;
&amp;lt;button onclick="openChat()" role="openchatbutton" class="open-button"&amp;gt;
 &amp;lt;i class="fa fa-4x fa-comments"&amp;gt;&amp;lt;/i&amp;gt;
&amp;lt;/button&amp;gt;
&amp;lt;div role="openchat" id="chatWindow" class="chat-popup" style="order: 3; position: relative; width: 400px; min-width: 400px; height: 100%;"&amp;gt;
 &amp;lt;div&amp;gt;
  &amp;lt;div id="webchat" role="main"&amp;gt;&amp;lt;/div&amp;gt;
 &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add Scripts
&lt;/h3&gt;

&lt;p&gt;Now let us add appropriate scripts. To do so, from the Settings menu; go to Script Inserter (as shown below).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ezgHXBrl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/09/03_scriptinsertersetting.png%3Fw%3D1024" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ezgHXBrl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/09/03_scriptinsertersetting.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On this page, you will see few text blocks with two section; one for Head section and another for Footer section. Now add the following scripts in appropriate textblocks.&lt;/p&gt;

&lt;p&gt;In the Head section on second text block add the following script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"&amp;gt;&amp;lt;/script&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the Footer section on first text block add the following script and replace the highlighted code with your own Bot Id.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script&amp;gt;
    // Only for Power Apps Portals
    const styleOptions = {

        // Add styleOptions to customize Web Chat canvas
        hideUploadButton: true,
        botAvatarInitials: 'TAB',
        userAvatarInitials: 'You',
        backgroundColor: 'rgba(255,255,255,0.85)'
    };

    // Add your BOT ID below 
    var BOT_ID = "YOUR BOT ID";
    var theURL = "https://powerva.microsoft.com/api/botmanagement/v1/directline/directlinetoken?botId=" + BOT_ID;

    fetch(theURL)
        .then(response =&amp;gt; response.json())
        .then(conversationInfo =&amp;gt; {
            window.WebChat.renderWebChat(
                {
                    directLine: window.WebChat.createDirectLine({
                        token: conversationInfo.token,
                    }),
                    styleOptions
                },
                document.getElementById('webchat')
            );
        })
        .catch(err =&amp;gt; console.error("An error occurred: " + err));
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see we have defined the background color to the bot in the above script but if you want to add more styling to your bot as well as your buttons then you need to add some css. To do that you need to navigate to &lt;strong&gt;Appearance&lt;/strong&gt; &amp;gt; &lt;strong&gt;Customize&lt;/strong&gt;. This will launch the customizer screen; on this screen if your theme permit you will see an option &lt;strong&gt;Additional CSS&lt;/strong&gt; (or some thing similar depending on your theme), click on it. This will show a CSS editor text block; add following css in this text block, and click &lt;strong&gt;Publish&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;div[role="form"] {
  background: rgba(255,255,255,0.6);
}  
div[role="status"] {
  border-bottom: 1px solid rgb(230, 230, 230);
} 
div[role="status"] button {
  border-color: rgb(0, 0,0,0.4) !important;
  color: rgb(0, 0, 0) !important;
} 
#webchat {
    position: fixed;
    height: calc(100% - 230px);
    z-index: 9999;
    width: 400px;
    top: 140px;
    right: 30px;
    overflow: hidden;
}
.chat-popup {
    display: none;
}
.open-button {
    background-color: transparent;
    color: white;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once all these steps are complete you can navigate to the page you added to see a button surfaced on the top-right corner. Clicking that button should show your bot window. To check out the demo &lt;a href="https://video.wordpress.com/embed/fLvQXukA?preloadContent=metadata&amp;amp;hd=1"&gt;&lt;strong&gt;click here&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To check out live demo I have kept the page still available on my wife’s website; so go to &lt;a href="http://coffeecompasscreations.com/test-bot/"&gt;&lt;strong&gt;http://coffeecompasscreations.com/test-bot/&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Have fun chatting!!&lt;/p&gt;

</description>
      <category>powerapps</category>
      <category>powervirtualagent</category>
      <category>bot</category>
    </item>
    <item>
      <title>Making Canvas Apps solution aware</title>
      <dc:creator>Danish Naglekar</dc:creator>
      <pubDate>Mon, 24 Aug 2020 13:08:45 +0000</pubDate>
      <link>https://dev.to/powermaverick/making-canvas-apps-solution-aware-3nmp</link>
      <guid>https://dev.to/powermaverick/making-canvas-apps-solution-aware-3nmp</guid>
      <description>&lt;p&gt;In this blog, we are going to look at two methods to make an existing Canvas App solution-aware. But before we start let us briefly cover what does “solution-aware” means? When you create your app directly from the App section on &lt;a href="https://make.powerapps.com/"&gt;make.powerapps.com&lt;/a&gt; they get created outside of a solution. To deploy them from one instance to another you will have to export it from canvas apps details page. Now, when you want to automate your deployment or even keep all components together you might want to add them into a particular solution. Even though you may have created the app outside of a solution there are ways to make them solution-aware; or in other words make them part of a particular solution.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When you go to canvas apps details page currently you do not see list of all solutions that a particular app is part of. If you like this idea then &lt;a href="https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Show-a-solution-section-on-Canvas-App-Details-page/idi-p/665666"&gt;vote for this idea&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As stated earlier as far as I know there are two ways of doing it. If you have any other way please let me know and I will add it to this blog (credits will be given to you).&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Out of box way
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Open your desired solution&lt;/li&gt;
&lt;li&gt;From the ribbon (menu) select &lt;code&gt;Add Existing &amp;gt; App &amp;gt; Canvas App&lt;/code&gt;. This will open a sidebar with list of existing canvas apps&lt;/li&gt;
&lt;li&gt;There are two tabs on this sidebar. Select “Outside solutions”. Click on this tab.&lt;/li&gt;
&lt;li&gt;Select your app and click “Add”.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This tab will present you with the list of all canvas apps that are not part of any solution. Adding it here will make them part of &lt;strong&gt;Common Data Service&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Demo:&lt;/p&gt;



&lt;h3&gt;
  
  
  2. Copy existing app to new app
&lt;/h3&gt;

&lt;p&gt;Now, most of the time first method should work. But in case the app doesn’t show up in the list of “Outside solutions” there is another way to make them solution-aware.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your desired solution&lt;/li&gt;
&lt;li&gt;Create a new app. From the ribbon (menu) select &lt;code&gt;New &amp;gt; App &amp;gt; Canvas App &amp;gt; (either Phone-form or tablet-form)&lt;/code&gt;. Provide your desired (temporary name), save and close this app.&lt;/li&gt;
&lt;li&gt;Go back to your existing app which is outside the solution and export it. Save the file locally.&lt;/li&gt;
&lt;li&gt;Use the import feature and with the above downloaded file start the import process.&lt;/li&gt;
&lt;li&gt;Here map the importing canvas app to your newly created (temporary name) solution-aware canvas app.&lt;/li&gt;
&lt;li&gt;Click on Import.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Demo:&lt;/p&gt;



&lt;p&gt;Hope this helps.&lt;/p&gt;

&lt;p&gt;Don’t forget to subscribe to my &lt;a href="https://www.powerplatformdevelopersweekly.com/"&gt;Power Platform ProDev Newsletter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>canvasapp</category>
      <category>powerapps</category>
      <category>powerplatform</category>
      <category>solutionaware</category>
    </item>
    <item>
      <title>Create Application User in Dataverse</title>
      <dc:creator>Danish Naglekar</dc:creator>
      <pubDate>Mon, 10 Aug 2020 11:47:28 +0000</pubDate>
      <link>https://dev.to/powermaverick/create-application-user-in-dataverse-1ac5</link>
      <guid>https://dev.to/powermaverick/create-application-user-in-dataverse-1ac5</guid>
      <description>&lt;p&gt;During integration there is always a need to perform authentications with several systems/applications; in this blog we are interested in Dataverse and while you can create an Office 365 user with username/password and configure it in Dataverse; it will consume a license. And if multi-factor authentication (MFA) is setup for that particular user then authentication might be little difficult. That is why Microsoft enabled users to create an application user that uses service principal based authentication.&lt;/p&gt;

&lt;p&gt;To create application user you need an active Azure subscription and a Dataverse license. The process is divided into two pieces: one register an App in Azure and second create user in Dataverse.&lt;/p&gt;

&lt;h2&gt;
  
  
  App Registration in Azure
&lt;/h2&gt;

&lt;p&gt;Once you log into &lt;a href="https://portal.azure.com/"&gt;Azure Portal&lt;/a&gt;, search “&lt;em&gt;App registrations&lt;/em&gt;” in the search box. On the App Registrations page, click New from the menu bar and you will be taken the registration page. On this page provide the name of your name and keep all other options as default. Click Register; this will take you to the &lt;em&gt;Overview&lt;/em&gt; page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/08/1-registrationpage.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ywamPen3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/1-registrationpage.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the overview page, you can find the tenant id, application id. Copy these ids as we will be needing them later.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/08/2-overviewpage.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NG5qa7XB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/2-overviewpage.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we need to create a client secret which will be used during authentication. To create the client secret, click on “&lt;em&gt;Certificates &amp;amp; secret&lt;/em&gt;” on the left blade, then under section “&lt;em&gt;Client secrets&lt;/em&gt;” click on &lt;strong&gt;New client secret&lt;/strong&gt;. This will pop-out a modal for you to enter your description and expiration. Enter a description that you can remember and choose “Never” for &lt;em&gt;Expires&lt;/em&gt;. The system will create a random client secret for you. &lt;strong&gt;Please copy and save the secret as this will be the only time you will see it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/08/3-createsecret.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--APW3DZwU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/3-createsecret.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point you should have tenant id, application id and client secret. But, we need to provide access to different APIs. To do so, click on “API permissions” on the left blade, then click on &lt;strong&gt;Add Permission&lt;/strong&gt;. Under Microsoft API, choose &lt;strong&gt;Dynamics CRM&lt;/strong&gt; ; and under permission check &lt;strong&gt;user_impersonation&lt;/strong&gt; ; click &lt;em&gt;Add permissions&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Similarly you can add more APIs, like for Power Platform Service Connection in Azure DevOps you need to add &lt;strong&gt;PowerApps Runtime Service&lt;/strong&gt;. Once you have added all the APIs, you will need to grant admin consent to those APIs. If the Grant admin consent is disabled then you will need to reach out to the Azure Admin to provide the consent. Finally the API permission page should look like below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/08/4-apipermissions.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pwxEWdet--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/4-apipermissions.png%3Fw%3D813" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating user in Dataverse
&lt;/h2&gt;

&lt;p&gt;Now, head to your Dataverse environment and go to &lt;code&gt;Settings &amp;gt; Security &amp;gt; Users&lt;/code&gt;. Make sure to change the view to &lt;em&gt;Application Users&lt;/em&gt;. Once on that view click on “ &lt;strong&gt;New&lt;/strong&gt; “. If “User” form loads then change it to “Application User” from the form selector. On this page enter your preferred username; something like &lt;em&gt;&lt;a href="mailto:integration.admin@yourdomain.com"&gt;integration.admin@yourdomain.com&lt;/a&gt;&lt;/em&gt;. Now, paste the copied application id from Azure on the Application ID attribute; enter the fullname and email address (can be same as username). Save the form – &lt;em&gt;even though Azure Object ID is required it will let you save&lt;/em&gt; – and system should populate “Application ID Uri” and “Azure AD Object ID”.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Don’t forget to provide proper security role to this user.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://danishnaglekar.files.wordpress.com/2020/08/5-applicationuser.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t83gNVUZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/5-applicationuser.png%3Fw%3D461" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you can use this user to authenticate using Service Principal; for that you will need Application Id and Client Secret we had copied from Azure.&lt;/p&gt;

&lt;p&gt;Hope this helps.&lt;/p&gt;

&lt;p&gt;Don’t forget to subscribe to my &lt;a href="https://www.powerplatformdevelopersweekly.com/"&gt;Power Platform Dev Newsletter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>crm</category>
      <category>dataverse</category>
      <category>dynamics365</category>
    </item>
    <item>
      <title>Authoring version in Canvas Apps</title>
      <dc:creator>Danish Naglekar</dc:creator>
      <pubDate>Mon, 03 Aug 2020 13:07:58 +0000</pubDate>
      <link>https://dev.to/powermaverick/authoring-version-in-canvas-apps-3e72</link>
      <guid>https://dev.to/powermaverick/authoring-version-in-canvas-apps-3e72</guid>
      <description>&lt;p&gt;Recently I came across an ability to change the authoring version of Power Apps Studio in Canvas App. So what exactly is authoring version?&lt;/p&gt;

&lt;p&gt;When you edit a Canvas app from &lt;a href="https://make.powerapps.com/"&gt;make.powerapps.com&lt;/a&gt; you are working with Power Apps Studio or some times also referred to as Authoring tool; where you build you apps. Microsoft keeps rolling out updates to this authoring tool on a regular basis. You can check out the history of released versions &lt;a href="https://docs.microsoft.com/en-us/business-applications-release-notes/powerplatform/released-versions/powerapps"&gt;here&lt;/a&gt;. So, authoring version is nothing but the version you are using to create your app in the Power Apps Studio.&lt;/p&gt;

&lt;p&gt;The feature I stumbled upon is the ability for us to change the authoring version of the Power Apps Studio and I am not sure if it already existed before or not but I found it useful as sometimes you want to keep using the old version just because you might not be ready to upgrade. But when you are ready, you can just hop in here and upgrade to latest version. When to upgrade would solely depend on the features that are rolled out in new version and your decision (obviously).&lt;/p&gt;

&lt;p&gt;So how do you change it? First, open any of your existing canvas app in the Power Apps Studio using the ‘ &lt;strong&gt;Edit&lt;/strong&gt; ‘ button. Under &lt;em&gt;File&lt;/em&gt; menu, you will find ‘ &lt;strong&gt;Account&lt;/strong&gt; ‘ as an option; click that and your screen will look like below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TIhSeyiW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/powerapps-about.png%3Fw%3D1024" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TIhSeyiW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/powerapps-about.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the link that says “ &lt;strong&gt;Change authoring version&lt;/strong&gt; ” as highlighted in above image. This will display a popup with list of versions; one would be the recommended version. Select your preferred version and click the button that states “Reload + apply version”. This will close the current app and reopen in edit mode with the updated version that you selected.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yQncDWve--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/powerapps-changeversion.png%3Fw%3D1024" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yQncDWve--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/powerapps-changeversion.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To verify if the changes were applied you can go to “ &lt;strong&gt;Account&lt;/strong&gt; ” option under &lt;em&gt;File&lt;/em&gt; and verify the version as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Cuv5LXRk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/powerapps-versionverify.png%3Fw%3D1024" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Cuv5LXRk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://danishnaglekar.files.wordpress.com/2020/08/powerapps-versionverify.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this helps. Keep PowerApp’ing&lt;/p&gt;

&lt;p&gt;Don’t forget to subscribe to my &lt;a href="https://www.powerplatformdevelopersweekly.com/"&gt;Power Platform Dev Newsletter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>canvasapp</category>
      <category>powerapps</category>
      <category>powerplatform</category>
      <category>powerappsstudio</category>
    </item>
    <item>
      <title>Getting Auth Token in Node JS without msal library</title>
      <dc:creator>Danish Naglekar</dc:creator>
      <pubDate>Sun, 26 Jul 2020 21:15:59 +0000</pubDate>
      <link>https://dev.to/powermaverick/getting-auth-token-in-node-js-without-msal-library-5bjh</link>
      <guid>https://dev.to/powermaverick/getting-auth-token-in-node-js-without-msal-library-5bjh</guid>
      <description>&lt;p&gt;In my current project, we had a need to build a Node JS app that will authenticate with an App Registration client id and client secret. First thing that came into my mind was to use &lt;a href="https://www.npmjs.com/package/@azure/msal"&gt;msal&lt;/a&gt; library. But I hit a snag due to CORS issue and there was very little I could do with the code as it was a boiler plate code and changes were limited.&lt;/p&gt;

&lt;p&gt;So, I went to the basics of Web Api call from JavaScript to authenticate with App Registration. For this I use the &lt;code&gt;request&lt;/code&gt; object and the code is as below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getAuthToken = async function() { let config = require(\_\_dirname + "/../config/config.json"); var request = require('request'); var options = { 'method': 'POST', 'url': 'https://login.microsoftonline.com/3bd27ef8-8d38-4656-86d2-5f0d90a73981/oauth2/token', 'headers': { 'Authorization': 'Basic ' + new Buffer(config.clientId + ":" + config.clientSecret).toString('base64'), 'Content-Type': 'application/x-www-form-encoded' }, form: { 'grant\_type': 'client\_credentials', 'resource': 'https://analysis.windows.net/powerbi/api' } }; return new Promise( (resolve, reject) =&amp;gt; { request(options, function (error, response) { if (error) { reject(error); } resolve(JSON.parse(response.body)); }); } );}module.exports.getAuthenticationToken = getAuthToken;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will notice that the config entries are defined in config.json file. Then we define request object and configure the options object. In this options object we define the method, url and headers needed along with the form. Because this is an authentication request, we need to supply the following headers:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Authorization&lt;/code&gt; which will be basic authentication with username and password encoded in base64.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Content-Type&lt;/code&gt; will be &lt;em&gt;application/x-www-form-encoded&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We also need to pass the body as a &lt;em&gt;form&lt;/em&gt;; as highlighted in the code. If you are going to use the token retrieved for some other request then need to pass the request domain in the &lt;code&gt;resource&lt;/code&gt;. Under form you should also specify &lt;code&gt;grant_type&lt;/code&gt; as &lt;em&gt;client_credentials&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This module returns a &lt;code&gt;Promise&lt;/code&gt; object by parsing the response body; as highlighted on the code.&lt;/p&gt;

&lt;p&gt;Hope this helps.&lt;/p&gt;

&lt;p&gt;Don’t forget to subscribe to my &lt;a href="https://www.powerplatformdevelopersweekly.com/"&gt;Power Platform Dev Newsletter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>authentication</category>
      <category>azure</category>
      <category>msal</category>
    </item>
  </channel>
</rss>
