CISA Releases Analysis Reports on New FiveHands Ransomware

This article is contributed. See the original author and article here.

CISA is aware of a recent, successful cyberattack against an organization using a new ransomware variant, known as FiveHands, that has been used to successfully conduct a cyberattack against an organization.  

CISA has released AR21-126A: FiveHands Ransomware and MAR-10324784-1.v1: FiveHands Ransomware to provide analysis of the threat actor’s tactics, techniques, and procedures as well as indicators of compromise (IOCs).  These reports also provide CISA’s recommended mitigations for strengthening networks to protect against, detect, and respond to potential FiveHands ransomware attacks.

CISA encourages organizations to review AR21-126A and MAR-10324784.r1.v1 for more information.

Introducing React Video Banner Web Part

Introducing React Video Banner Web Part

This article is contributed. See the original author and article here.

In this post, we will see how easy it is to build a cool looking video banner web part using SPFx with the help of PnP reusable property pane controls. First of all, the requirements: 



  • The web part should look like a banner on top of pages, with a video playing

  • Ability to change the overlay text on this video

  • Control the banner area size


This is what the PnP React Video Banner web part offers, once you add the web part to your page, you will be able to select a video (using the file picker control from the PnP Reusable Property Pane Controls), you will be able to modify the text overlay and its color, control the height of the video area and lastly (at least for now) modify the brightness: 


 


  derhallim_0-1620249069072.png


 


 These settings would provide you with a web part that looks like this: 


 


 derhallim_4-1620249695924.png


 


 


Now let’s have a look at the code itself which is pretty simple. The file structure can be seen below:


 


                                                                


 derhallim_1-1620252146944.png


 


 


The web part has only one functional component named: VideoBackground that accepts the following properties as defined in the IVideoBackgroundProps.ts file: wpTitle (string), videoUrl (string), labelColor (string), brightness (number), height (number).


 


 derhallim_2-1620252225550.png


 


The video url and the label color are set with the help of PnP Property Pane Controls as shown below: 


 


 derhallim_0-1620252048668.png


 

 


Once the properties are setup on the VideoBackgroundWebPart.ts file, we pass them to the VideoBackground.tsx component. 


 



 derhallim_6-1620252844193.png

 



 

All good so far? Now in our functional component, we have an HTML video control where the source of the video is set to the videoUrl prop we pass and we play with the CSS filter prop to set the brightness by adding the value concatenated with % as we need a brightness percentage: 

 

 derhallim_3-1620252272134.png

 





 




 


Notice the ref attribute on the video control? The reason we have it is that we want to refresh the video whenever we change the video url. By default, when changing the properties, all values will be reflected except for the video url, it needs to be explicitly refreshed on the video control. So we get a reference to the video control using React’s ref, where we define the “vRef” value on the functional component itself. 


 


We then use React’s useEffect to check if the video url has changed or not, if it has changed, we call the load() function on the video reference itself: 


 



 derhallim_4-1620252332115.png

 



 

Some notable points about the CSS used is the div that’s available just before the video control, it’s aligned using an absolute position with a display of flex to position the h1 element inside of it. The video element itself has a CSS property object-fit: cover.

 

As demonstrated, with SPFx and the help of PnP Reusable Property Pane controls, building web parts using modern development techniques is very easy and isn’t time consuming as some may think! Source code is available on Github along with other awesome web parts by the community, for more information about all the PnP offerings, checkout https://aka.ms/m365pnp 

#SharingIsCaring

 

 


 

Using Power Automate And Graph API To Manage External Access To Teams

Using Power Automate And Graph API To Manage External Access To Teams

This article is contributed. See the original author and article here.

Matt Collins Jones and I presented API’s – The most powerful tool, anyone can use! for D365 UG and Swiss Power Saturday recently and I thought it would be good to share the Cloud Flow I created to automate the onboarding of external users to a Microsoft Team.


This is usually an admin driven activity – A team owner will have to type in the email address for each guest they want to add, rather than something you can push to external users and allow them to request access.


By using the Graph API via a Custom Connector, Microsoft Forms and Power Automate, we are able to realise this quickly and save a lot of time and effort in the manual process.


Also, I have been lucky to have this solution accepted as part of the samples in the Microsoft Patterns And Practices initiative, so the Flow, Custom Connector and implementation instructions are available in GitHub here.


Getting Hands-On With Graph


The main part of this flow is numerous calls to the Graph API. The Graph API is Microsoft’s standard endpoint to expose and interact with data relevant to your tenant. It includes Microsoft 365 (such as Teams, Exchange, SharePoint, Workspace Analytics), Enterprise and Mobility and even Windows 10 activities and devices. It really should be seen as a single stop shop for anything and everything in your tenant. The only thing it doesn’t expose is D365 data.


 


There is a Graph connector already available in Power Automate, but it is very limited to Security considerations. Thankfully, the rest of the Graph API abilities are available, but you have to go via a custom connector. You could call these directly via an HTTP request action, but by wrapping the Graph API in a connector, you are enabling other members of your organisation to re-use the connector and security you establish.


 


Microsoft also allows you to “play” with the Graph API as well, via the Graph Explorer. This web interface shows you all the sample calls you can make and also what permissions you require to call it and allows you to set up a call without using Power Automate or configuring a connector. It really should be the starting point for any Graph Customer Connector.



LinkeD365_0-1620296690001.png

 




If things go wrong, it is usually around the permissions. Within the Graph Explorer you can consent to these extra permissions on the fly, but more importantly, tells you what you need to configure in the permissions of your App registration to allow your connector the same access.



LinkeD365_1-1620296689997.png

 


Granting Permissions


Now that we understand what permissions that are needed to get at the actions required, let’s jump in and create an Azure App Registration. This allows you to grant rights to a particular application, which presents a client secret and App ID as part of the request. By doing this registration, you establish trust between your app (Custom Connector in our case) and your tenant.


 


Navigate to https://aad.portal.azure.com and log in. Select Azure Active Directory then App registrations. Select New, give it an appropriate name then hit Register.


 


In the next screen, record the Application Id, going to need it later. On the left, select Certificates & secrets



LinkeD365_2-1620296727206.png

 




Select New client secret give it a name & expiry date and select Save.



LinkeD365_3-1620296726932.png

 




Ensure you copy the Value here, you will only be able to see this for a short while, if you navigate away it will be gone. Not a big deal, just recreate the client secret, but you will need it later. Now select API permissions. This will list what permissions this registration has, and by inference, the caller using the client secret/application id.


 


Select the Add a permission button.



LinkeD365_4-1620296727532.png

 




This presents a choice of which API to expose. The first on the list is Microsoft Graph, the one we want.



LinkeD365_5-1620296727260.png

 




Select Delegated Permissions (Custom connectors doesn’t support Application permissions yet, will run in the context of the person who runs the flow, so use an admin/system account) then type in the permission you want, listed here.



  • Directory.ReadWrite.All

  • User.Invite.All

  • User.ReadWrite.All



LinkeD365_6-1620296727107.png

 




Select Add Permissions to return you to the Configured permissions screen, then select Grant Admin consent button. This shortcuts and pre-approves the app.


 


Leave this tab open and let’s go and define our custom connector.


 


Defining The Custom Connector


Jan Bakker has done an excellent job of walking you through this, here. His article goes into a lot of detail, so I will just take you through what is needed for this project.


 


In make.powerapps.com, select the appropriate environment and chose Custom Connectors under Data. Then select New custom connector. You can import from various sources, but we want to create from blank, give it a name then fill out the next page.



LinkeD365_7-1620296727214.png

 




On the next screen, there are four tabs, which we need to step through. First the General Tab.



LinkeD365_8-1620296727082.png

 




Other stuff is nice to have and you should document your work. Ensure Scheme is HTTPS and Host/Base URL are populated.



  • Host – graph.microsoft.com

  • Base URL – /v1.0


Select the Security Tab next, Authentication type is OAuth 2.0. You should be presented with the below screen.



LinkeD365_9-1620296727183.png

 




Now, this is where we need to use the values you saved (you did save them?) when you were registering your app up here. Client Id is populated with the Application (client) ID, the Client secret is populated with the Value from the Client Secret grid. Login URL will be populated for you. The Resource URL value should be https://graph.microsoft.com.Select Create Connector now, as you need the Redirect URL, created when you create the connector to put back into your App registration to complete the security process.


 



LinkeD365_10-1620296727075.png

 




I think that this is now standard, but just in case, copy the Redirect URL and go back to your App Registration in Azure AD. Click on the link highlighted.



LinkeD365_11-1620296727170.png

 




Select Add a platform then chose Web. Enter the Redirect URL from the Custom Connector. Now we are ready to define the actions for our connector.


Creating the Actions


For our flow, we need 3 actions, Get the owners of a team, Get a user and Invite a User. This is where Graph Explorer and Postman help. You need to establish what you are sending and what you expect back for each action. For example, lets walk through the Get Owners of a team.


 


Select New Action and Populate General section. The Operation ID needs to be unique and is what appears within Power Automate when you select it.



LinkeD365_12-1620296727067.png

 




I usually use the same for each, but be creative and descriptive. Select Import from sample then use the url below as the URL and select Get as the Verb.


 


URL – https://graph.microsoft.com/v1.0/groups/{teamId}/owners



LinkeD365_13-1620296727114.png

 




By placing teamid in curly brackets { } you denote to the custom connector you want to use a parameter in that URL. You can call https://graph.microsoft.com/v1.0/groups/{teamId} (without the /owners) but that will return the detail from the group. In this I want get associated data, hence the /owners.


 


Select Import. You are returned to the definition screen, where we can see that the request has been populated for us.



LinkeD365_14-1620296727100.png

 




We are ready to test our Get Owners now. Update the connector once more then head over to the Test tab. You will have to create a connection if not already done, which prompts you to establish who you are running the connector under (only for testing). Then supply a team id. These can be found by using Graph Explorer to find all teams. Hit the Test operation and if everything is working you will get a 200 response with some JSON in a body showing you all the information about the owners.



LinkeD365_15-1620296727218.png

 




To just define the others


Get User


Verb: Get, URL: https://graph.microsoft.com/v1.0/users?$filter=


Invite User


Verb: Put, URL: https://graph.microsoft.com/v1.0/invitations, Body is below, as you need to define a new invite, with the required parameters. The data doesn’t matter, just the parameters that you need to pass.

{
    "invitedUserEmailAddress": "emailaddress",
    "inviteRedirectUrl": "https://myapp.contoso.com",
    "invitedUserDisplayName": "Testy McTest",
    "sendInvitationMessage": true
}

Make sure you test all your actions and lets move on to the Form.


Microsoft Form To Capture Information


Not going to dwell here, as others are doing a much better job at describing Forms. Basically, a simple form to define First and Last name, the email address and a choice field to define which team the user wants access to.



LinkeD365_16-1620296727638.png

 




The teams list will have to be maintained to those that you want the public to be able to request access to.


 


Finally, lets take a look at the flow.


Power Automate Definition


This Flow is triggered by a new response being submitted against the Form defined above. Next, get the response details.



LinkeD365_17-1620296727108.png

 




Next, retrieve all the Teams in your environment. This will return a JSON object which defines an array of Team definitions. We need to filter that to the one the user selected so that we can get the team id.



LinkeD365_18-1620296726929.png

 




To do this, I use the Filter Array action, pass in the output from the List Teams and ensure we select where team Name is equal to the team selected (the Which Team? field in my case).



LinkeD365_19-1620296726827.png

 




Next, is a compose statement. I do that just to simplify the way the flow works, as the return of filter array is an array, and I just want the first one.



LinkeD365_20-1620296726837.png

 



body('Filter_array')[0]?['id']

Next, lets get the Owners of the team selected, using the Id just retrieved. This is the first time using the Custom Connector, it is available under the Custom Tab.



LinkeD365_21-1620296726920.png

 




Selecting the connector will show the actions or triggers available.



LinkeD365_22-1620296726951.png

 




The parameters are those that were defined in the Custom connector, passing in the output from the compose above.



LinkeD365_23-1620296726812.png

 




Now, the response back from Get Owners is a JSON object, so next, Parse the JSON so there is a list of JSON objects for the flow to use. All that is needed in the approval that comes next is the email address(es) of the return from the owners call. But the approval needs a semi-colon separated list of emails. To achieve this, firstly use a Select to just return the email address from the JSON object, then join the output to that with a semi colon.



LinkeD365_24-1620296727149.png

 




Next, start an approval. This is populated to let the owner know who has asked for access to the team and which team.



LinkeD365_25-1620296726984.png

 




Check whether the response is positive. If this was for production, I would probably send an email to the requesting user to let them know that they were denied access. You could also use the response written in the rejection.



LinkeD365_26-1620296726933.png

 




In the Yes path, call the Custom connector again to check if the user is already a part of your organisation as a guest user. As the parameter is expecting a query, use the expression below



LinkeD365_27-1620296726901.png

 




mail eq ‘Email Parameter from the Form response’

mail eq 'Email Parameter from the Form response'

 


Next, check the length of the returned object from the custom connector. This basically checks if the user already belongs to your environment.



LinkeD365_28-1620296726899.png

 




length(outputs(‘GetUser’)?[‘body/value’])

 


If there is a value in the return, use the return to invite the user to the team.



LinkeD365_29-1620296726913.png

 




The User id is returned by using the expression below

body('GetUser')?['value'][0]?['id']

 


On the negative side, firstly invite the user to your organisation by using the final action of the custom connector.



LinkeD365_30-1620296727013.png

 




And finally, use the response from your custom connector, the invited user to the team.



LinkeD365_31-1620296727008.png

 




That’s it! There is a lot of configuration here, but you can see how you can extend your usage of Power Automate to automate a function usually confined to manual work by the team owner.

This post was originally published on LinkeD365.blog



Simple reminders for any Teams Channel or Chat message

Simple reminders for any Teams Channel or Chat message

This article is contributed. See the original author and article here.

Forgetting to take action on a message, or where that message was?Forgetting to take action on a message, or where that message was?


For busy people who have their lives invested in Microsoft Teams, whether collaborating with colleagues in Team Channels or using the Chat functionality, it’s easy to forget:



  • To take action or reply to a message

  • The location of where that message is! Is it in a Chat, or a Team Channel? How far up do I have to scroll?


Outlook’s solution: a well trodden path for many


Flags in Outlook have been the bridge to emails and task managementFlags in Outlook have been the bridge to emails and task management


 


 


In Outlook, there are “flags” which can be set to remind yourself to take action for a particular email.


 


However, this functionality is missing from Teams. Even if you are a well seasoned ToDo and Planner user, you would still have to use the Copy Link feature and paste that into the ToDo/Planner task, which can be quite tedious. 


Copy link to a Teams Channel messageCopy link to a Teams Channel message


Plus I entering a phase where I was forgetting that I had to respond to messages. Sometimes I ended up talking to Google (I use an Android phone, so you might be talking to Siri) to remind myself, but that still doesn’t take you straight back to the original message with a single click – you still had to do a lot of navigation before you arrived at the message you were supposed to take action on.


 


My poor colleagues were also getting flooded with Teams messages. If they were diligent and cleared their activity bell notifications, they would potentially lose track of a visual reminder that they need to prompt them to action on a message.




So what if you just needed a simple and effective visual reminder, either at some hours/minutes down the track or at a specific time?




A Flow, some delay, and four Adaptive Cards


In comes Power Automate with a few adaptive cards to the rescue – this flow will generate a reminder via the Flow bot at a certain number of hours/minutes, or at a specified time to remind you to take action for a message!


The reminder card we wish to send ourselvesThe reminder card we wish to send ourselves


 


The beauty of this Flow is that it will give you one-click access back to the conversation thread within the team, or back to the chat with a person or a group of people. 


 


So in the blog post below, the Flow will be explained in greater detail, and some caveats highlighted for anyone wanting to pursue this quick reminder flow!


 




Note: this was partially inspired by Microsoft’s own template that you can create directly from Power Automate, but extends it to bring more flexibility to the reminder time, and also bring a far more visual experience via adaptive cards rather than just the Flow bot.




Inspired by Microsoft


When I first saw the template provided by Microsoft, I thought: this is nice, but it’s a bit too elementary with the fixed timeframes from the choice radio buttons:


 


Microsoft's own sample FlowMicrosoft’s own sample Flow


 


...is perhaps a bit too restrictive…is perhaps a bit too restrictive


 


However, that was definitely a starting point. The sample Flow used an adaptive card (with some Input.Choice options) and a Delay action. Why not take this further?


Ingredients


Here’s the “ingredients” needed for the flow to allow ourselves to set a reminder at a particular hour/minute offset from now OR at a specific time:



  1. One to get user input regarding when they’d like to be reminded

    The reminder setting card can accept an hour/minute offset or absolute time as inputThe reminder setting card can accept an hour/minute offset or absolute time as input



  2. One for the reminder itself:

    The reminder card itself, with links to the original message and chat with message authorThe reminder card itself, with links to the original message and chat with message author



  3. Two other cards which are for catching errors:
    Cards reminding users of input errorCards reminding users of input error


The Flow


1. Data entry card


So the concept is basically taken from what Microsoft provided, but here we extend the adaptive card by using an Action.ToggleVisibility button to show and hide parts of a card: the relative time entry and the absolute time entry containers, in blue and green respectively:


The reminder setting card, with an initially invisible containerThe reminder setting card, with an initially invisible container


 


The Change reminder type button within the gray container is Action.ToggleVisibility button that you can add from the card elements bar on the left of the adaptive card designer screen. The JSON code looks like this:


Action Toggle Visibility.png


 


The action button targets the section-hours (blue) and section-absolute-time (green) containers – i.e. when pressed, turns the visibility of section-hours off and section-absolute-time (as the respective ids of the containers) on, and vice versa. The blue and green containers are never on at the same time.


 


The ID and initial visibility of the blue containerThe ID and initial visibility of the blue container


 For the Change reminder type button to turn the blue and green containers on and off, the Initially visible checkbox must be



  • Checked for the blue container

  • Unchecked for the green container:


The green container should initially be invisibleThe green container should initially be invisible


Within the containers are also ColumnSets to house the fields side by side, just to make it look nice.


Use the ColumnSet to place fields and labels (as TextBlock) adjacent to each otherUse the ColumnSet to place fields and labels (as TextBlock) adjacent to each other


 The fields also need TextBlocks above them as their labels (until we get Adaptive Cards v1.3 in Teams), as well as having some of the parameters set properly:


Set some restrictions on the fields, and place TextBlocks above them as labelsSet some restrictions on the fields, and place TextBlocks above them as labels


Finally, the orange container just contains what to remind yourself of, and has an Input.ChoiceSet to provide the dropdown menu:


Input.ChoiceSet for dropdown menuInput.ChoiceSet for dropdown menu


 


Below is the complete JSON code for the adaptive card that captures the user input:


 


 


 


 


 


 


 

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.2",
    "body": [
        {
            "type": "Container",
            "bleed": true,
            "style": "warning",
            "items": [
                {
                    "type": "ColumnSet",
                    "columns": [
                        {
                            "width": "75px",
                            "type": "Column",
                            "items": [
                                {
                                    "type": "Image",
                                    "url": "https://normanhurb-h.schools.nsw.gov.au/content/dam/doe/sws/schools/n/normanhurb-h/icons/schedule.png"
                                }
                            ]
                        },
                        {
                            "width": "stretch",
                            "type": "Column",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "weight": "Bolder",
                                    "size": "Large",
                                    "text": "**Set myself a reminder about this message**",
                                    "color": "Attention",
                                    "fontType": "Default",
                                    "wrap": true
                                }
                            ],
                            "verticalContentAlignment": "Center"
                        }
                    ]
                }
            ]
        },
        {
            "type": "TextBlock",
            "isSubtle": true,
            "wrap": true,
            "text": "Fill out this card in entirety, and you'll be reminded by the Flow bot after the time selected."
        },
        {
            "type": "Container",
            "separator": true,
            "style": "emphasis",
            "items": [
                {
                    "type": "ColumnSet",
                    "columns": [
                        {
                            "type": "Column",
                            "width": "auto",
                            "items": [
                                {
                                    "type": "ActionSet",
                                    "actions": [
                                        {
                                            "type": "Action.ToggleVisibility",
                                            "title": "Change reminder type",
                                            "targetElements": [
                                                "section-hours",
                                                "section-absolute-time"
                                            ]
                                        }
                                    ],
                                    "spacing": "None"
                                }
                            ],
                            "verticalContentAlignment": "Center"
                        },
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Click on Change reminder type to select whether to remind myself at a specific time, or after a certain number of hours from now.",
                                    "wrap": true,
                                    "color": "Accent",
                                    "weight": "Bolder"
                                }
                            ],
                            "verticalContentAlignment": "Center"
                        }
                    ]
                }
            ]
        },
        {
            "type": "Container",
            "style": "accent",
            "items": [
                {
                    "type": "TextBlock",
                    "wrap": true,
                    "color": "Accent",
                    "weight": "Bolder",
                    "text": "Remind myself after"
                },
                {
                    "type": "ColumnSet",
                    "columns": [
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Hours",
                                    "wrap": true,
                                    "maxLines": 0,
                                    "spacing": "None",
                                    "isSubtle": true,
                                    "size": "Small"
                                },
                                {
                                    "type": "Input.Number",
                                    "placeholder": "Type in the delay in hours",
                                    "id": "remind-hours-later",
                                    "spacing": "None",
                                    "min": 0,
                                    "max": 670
                                }
                            ]
                        },
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Minutes",
                                    "wrap": true,
                                    "size": "Small"
                                },
                                {
                                    "type": "Input.Number",
                                    "placeholder": "Type in the delay in minutes",
                                    "spacing": "None",
                                    "min": 1,
                                    "max": 59,
                                    "id": "remind-minutes-later"
                                }
                            ]
                        }
                    ]
                },
                {
                    "type": "TextBlock",
                    "wrap": true,
                    "text": "Hours and minutes can contain decimals, e.g. **1.2 hours = 1 hour 12 minutes**",
                    "spacing": "None",
                    "size": "Small"
                }
            ],
            "id": "section-hours"
        },
        {
            "type": "Container",
            "style": "good",
            "items": [
                {
                    "type": "TextBlock",
                    "wrap": true,
                    "color": "Accent",
                    "weight": "Bolder",
                    "text": "Remind myself at this time"
                },
                {
                    "type": "ColumnSet",
                    "columns": [
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Date",
                                    "wrap": true,
                                    "maxLines": 0,
                                    "spacing": "None",
                                    "isSubtle": true,
                                    "size": "Small"
                                },
                                {
                                    "type": "Input.Date",
                                    "id": "remind-date",
                                    "spacing": "None"
                                }
                            ]
                        },
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Time",
                                    "wrap": true,
                                    "maxLines": 0,
                                    "spacing": "None",
                                    "isSubtle": true,
                                    "size": "Small"
                                },
                                {
                                    "type": "Input.Time",
                                    "id": "remind-time",
                                    "spacing": "None"
                                }
                            ]
                        }
                    ]
                },
                {
                    "type": "TextBlock",
                    "text": "Ensure that n- Both **Date** and **Time** are selectedn- Date and time are no later than 30 days of the current time",
                    "wrap": true,
                    "size": "Small",
                    "spacing": "None"
                }
            ],
            "id": "section-absolute-time",
            "isVisible": false
        },
        {
            "type": "Container",
            "style": "attention",
            "items": [
                {
                    "type": "TextBlock",
                    "wrap": true,
                    "color": "Accent",
                    "weight": "Bolder",
                    "text": "Remind myself to"
                },
                {
                    "type": "Input.ChoiceSet",
                    "choices": [
                        {
                            "title": "Reply to the message",
                            "value": "message-reply"
                        },
                        {
                            "title": "Get something done",
                            "value": "message-get-something-done"
                        }
                    ],
                    "placeholder": "Select the action to be reminded of",
                    "spacing": "None",
                    "id": "message-subsequent-action"
                }
            ]
        }
    ]
}

 


 


 


 


 


 


 


2. Reminder card groundwork


After some experimentation with the For a selected message trigger for Teams, it seems that there is a good amount of dynamic content that would be useful for the reminder card:


For a selected (Teams) message provides a lot of useful dynamic contentFor a selected (Teams) message provides a lot of useful dynamic content


 


We will return to this card after looking at the upcoming sections after having a look at the actions which the flow will take.


 


3. Variables required


Some variables are required to hold hold some of the data:


Some variables are required to hold the time informationSome variables are required to hold the time information


 


Then we get the user profiles of the message sender and the person who initiated the flow: interestingly, only the AAD ID is available as dynamic content from the trigger, but thankfully the Get user profile (V2) action is able to handle this and return all of the information required:


z3019494_1-1620122926624.png


4. Check for Chat or Channel conversation message and what action to take


We then build the Original message information block by testing whether the message came from a private chat, or from a Team channel with a simple check of whether the team dynamic content is null or not (input null as an expression, not dynamic content):


Check whether the message is in a Chat or Channel, and building the adaptive card to suit the occasionCheck whether the message is in a Chat or Channel, and building the adaptive card to suit the occasion


 


 



  • If the message is from a Team Channel, then the List channels action is run, and a filter applied so that only the Channel Name is extracted out of the channels of the team.

    • Channel Id is from the List channels action

    • Channel ID (note the case sensitivity!) is from the From a selected message action.



  • The JSON card blocks are then saved in the TeamChannelBrick variable.


 


The ActionToTake variable is also populated after checking for whether it’s been left blank, or one of the selections have been made:


Checking whether the ActionToTake choice has been set, and building the adaptive card brick to suit the inputChecking whether the ActionToTake choice has been set, and building the adaptive card brick to suit the input


 


 


5. Time calculations, data types & error handling 


The difficult part is this bit: making sure the user’s inputs for hours/minutes, or absolute time is valid!


 


We quickly check whether either date or time entered is null or not, and if so, the user probably has inputted the hour/minute offset instead since that is the default:


Checking to see whether absolute or relative time delay has been inputtedChecking to see whether absolute or relative time delay has been inputted


 


 


 


 


In the case where the user enters the hours/minutes offset to be reminded:



  • Check whether the Hours entered is blank or not (note that there’s a very subtle difference between blank and null!). If so, set the HoursToDelay variable to a “0” or simply use the hours inputted.

  • Check whether the Minutes entered is blank or not. If so, set the MinutesToDelay variable to a “0” or simply use the hours inputted.


z3019494_1-1620123840984.png


Finally, the TotalTimeDelay is set to the following expression:


mul(add(mul(variables(‘HoursToDelay’),60),variables(‘MinutesToDelay’)),60)

e.g.



  1. multiply the number of hours by 60 to obtain the number of minutes

  2. add that to the number of minutes to delay by

  3. multiply the final result up by another 60 to obtain the number of seconds


In the case where the user specifies an absolute time to be reminded


A lot more string processing is required!


 



  1. Compose – date selected: compose the date/time that the user selected, into ISO8601 format. The caveat here: you need 7 decimal places after the seconds!

  2. Compose – ticks of date to delay until: find the number of ticks from the previous compose action:

    ticks(outputs(‘Compose_-_date_selected’))


  3. Convert time zone – to UTC+10 (where I live): change this to wherever you are in the world.

  4. Compose – ticks of current time: get the current time’s ticks

  5. Compose – difference in ticks: subtract the ticks of current time (4) from the ticks of the selected time (1).

  6. Then check for whether the selected date is before the current time by seeing whether (5) is a negative number of not in the Condition – check selected date isn’t on or before reminder date

  7. Then do some final checks for whether the number of seconds falls on “0” by

    1. Converting the ticks into minutes/seconds (Compose – ticks to seconds)

      The TotalTimeToDelay variable in this instance, should contain this expression:

      add(0,div(outputs(‘Compose_-_difference_in_ticks’),10000000))


    2. Checking whether there’s remnant seconds (by looking for modulo 60) in Compose – modulo seconds action. If the number of seconds to delay by, falls on “0” then just add 1 more second to it in case the user enters a time which is just less than 1 minute as the div formula will only work with integers. 

      The TotalTimeToDelay variable in this instance, becomes this expression instead:

      add(1,div(outputs(‘Compose_-_difference_in_ticks’),10000000))


      The reason for this check is that the Delay action, is very fussy. It only takes integers, and can’t cope with an input of (you’d think that an input of “0” into the Delay action would just cause it to continue full steam ahead instead of sitting there and waiting!)




Absolute time calculations: finding out the TotalTimeToDelayAbsolute time calculations: finding out the TotalTimeToDelay


 


One final major condition block: check to see if the user has set a date over 28 days (or 720 hours)


 


We check the TotalTimeToDelay variable and see how many days it has racked up:


div(int(variables(‘TotalTimeToDelay’)),86400)

This check is needed as Power Automate will time out after 30 days. But let’s just be a little more conservative and set that at 28 days, and throw an error if so. This will ensure no reminders (especially those over 30 days) are quietly dumped without the user’s knowledge.


Double checking that the user has entered a date no further than 28 days out to ensure the flow doesn't time outDouble checking that the user has entered a date no further than 28 days out to ensure the flow doesn’t time out


 


 


The adaptive card that reports the error if a user enters a date that is greater than 28 days:


 


 


 

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.2",
    "body": [
        {
            "type": "Container",
            "bleed": true,
            "style": "warning",
            "items": [
                {
                    "type": "ColumnSet",
                    "columns": [
                        {
                            "width": "75px",
                            "type": "Column",
                            "items": [
                                {
                                    "type": "Image",
                                    "url": "https://normanhurb-h.schools.nsw.gov.au/content/dam/doe/sws/schools/n/normanhurb-h/icons/error.png"
                                }
                            ]
                        },
                        {
                            "width": "stretch",
                            "type": "Column",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "weight": "Bolder",
                                    "size": "Large",
                                    "text": "**Error in setting a reminder for Teams message**",
                                    "color": "Attention",
                                    "fontType": "Default",
                                    "wrap": true
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "Reminder set for too far ahead!",
                                    "wrap": true,
                                    "size": "Large",
                                    "weight": "Bolder",
                                    "color": "Accent",
                                    "spacing": "None"
                                }
                            ],
                            "verticalContentAlignment": "Center"
                        }
                    ]
                }
            ]
        },
        {
            "type": "TextBlock",
            "isSubtle": true,
            "wrap": true,
            "text": "Oops. You've tried to set yourself a reminder for @{outputs('Compose_-_check_for_28_day_limit')} days later! Please ensure you set it for less than 28 days.nnIf you need something more sophisticated, use **Microsoft To Do** or **Microsoft Planner**."
        },
        {
            "type": "TextBlock",
            "text": "Original message information",
            "wrap": true,
            "separator": true,
            "size": "Small",
            "color": "Accent"
        },
        {
            "type": "FactSet",
            "facts": [
                {
                    "title": "Message author",
                    "value": "@{outputs('Get_user_profile_(V2)_-_person_who_typed_the_message')?['body/displayName']}"
                }
            ],
            "spacing": "None"
        },
        {
            "type": "TextBlock",
            "text": "Original message",
            "wrap": true,
            "separator": true,
            "color": "Accent",
            "size": "Small"
        },
        {
            "type": "TextBlock",
            "text": "@{triggerBody()?['entity']?['teamsFlowRunContext']?['messagePayload']?['body']?['plainText']}",
            "wrap": true,
            "spacing": "None"
        },
        {
            "type": "Container",
            "separator": true,
            "style": "emphasis",
            "items": [
                {
                    "type": "ColumnSet",
                    "columns": [
                        {
                            "type": "Column",
                            "width": "50px",
                            "items": [
                                {
                                    "type": "Image",
                                    "url": "https://normanhurb-h.schools.nsw.gov.au/content/dam/doe/sws/schools/n/normanhurb-h/icons/alert.png"
                                }
                            ]
                        },
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Action that you were going to take",
                                    "wrap": true,
                                    "separator": true,
                                    "color": "Accent",
                                    "size": "Small"
                                },
                                {
                                    "type": "TextBlock",
                                    "wrap": true,
                                    "spacing": "None",
                                    "text": "@{variables('ActionToTake')}"
                                }
                            ],
                            "verticalContentAlignment": "Center"
                        }
                    ]
                }
            ]
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.OpenUrl",
                    "title": "Go back to the message and set the reminder again",
                    "iconUrl": "https://normanhurb-h.schools.nsw.gov.au/content/dam/doe/sws/schools/n/normanhurb-h/icons/teams.png",
                    "url": "@{triggerBody()?['entity']?['teamsFlowRunContext']?['messagePayload']?['linkToMessage']}"
                }
            ]
        }
    ]
}

 


 


 


6. The Delay vs Delay Until action


Setting the delaySetting the delay


 


We are now ready to delay the flow!


 


Initially there was a consideration to use the Delay Until action if the user enters an absolute date/time, until a major stumbling block was encountered: time zones!


 


Power Automate basically works in UTC or UTC-8, whereas I live in UTC+10. Having said that, the documentation for the Delay Until action is quite scant, and it doesn’t seem to take into consideration what timezone you are in. Hence all of the effort to subtract ticks and calculate remnant seconds etc when the user selects the date/time option.


7. Oops – don’t forget the characters that adaptive cards dislike!


Two more Compose actions are required before we pop the reminder card out, namely:


z3019494_2-1620126836459.png


 


Unfortunately if you wanted to insert the Plain Text Message dynamic content into the replace formula, you’re almost out of luck. Here’s where Compose comes to the rescue. The Compose – PTM without quotes action has this in its formula:


 


replace(replace(outputs(‘Compose_-_Plain_Text_Message’),'” ‘,”),’ “‘,”)

which replaces every instance of spacedouble-quote and double-quotespace with empty strings, in order to not allow the reminder card to spit the dummy with any double quotation marks.


 


8. The reminder card’s code


With the TotalChannelBlock variable inserted into the appropriate location so that the correct information about the message is displayed to the user who initiated the flow:


 


z3019494_3-1620127059580.png


…and a summary at the bottom of the card (pop the Show advanced options open!) to ensure a summary is sent – especially useful if your smartwatch notifications rely on a summary of sorts:


 


z3019494_0-1620127122452.png


 


 


 


 

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.2",
    "body": [
        {
            "type": "Container",
            "bleed": true,
            "style": "warning",
            "items": [
                {
                    "type": "ColumnSet",
                    "columns": [
                        {
                            "width": "75px",
                            "type": "Column",
                            "items": [
                                {
                                    "type": "Image",
                                    "url": "https://normanhurb-h.schools.nsw.gov.au/content/dam/doe/sws/schools/n/normanhurb-h/icons/schedule.png"
                                }
                            ]
                        },
                        {
                            "width": "stretch",
                            "type": "Column",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "weight": "Bolder",
                                    "size": "Large",
                                    "text": "**Reminder for Teams message**",
                                    "color": "Attention",
                                    "fontType": "Default",
                                    "wrap": true
                                }
                            ],
                            "verticalContentAlignment": "Center"
                        }
                    ]
                }
            ]
        },
        {
            "type": "TextBlock",
            "isSubtle": true,
            "wrap": true,
            "text": "This is a reminder message you set for yourself atn"
        },
        {
            "type": "TextBlock",
            "text": " **@{body('Convert_time_zone_-_time_executed')}**.",
            "wrap": true,
            "spacing": "None"
        },
        {
            "type": "TextBlock",
            "text": "Original message information",
            "wrap": true,
            "separator": true,
            "size": "Small",
            "color": "Accent"
        },
        {
            "type": "FactSet",
            "facts": [
@{variables('TeamChannelBrick')}
            ],
            "spacing": "None"
        },
        {
            "type": "TextBlock",
            "text": "Original message",
            "wrap": true,
            "separator": true,
            "color": "Accent",
            "size": "Small"
        },
        {
            "type": "TextBlock",
            "text": "@{outputs('Compose_-_PTM_without_quotes')}",
            "wrap": true,
            "spacing": "None"
        },
        {
            "type": "Container",
            "separator": true,
            "style": "attention",
            "items": [
                {
                    "type": "ColumnSet",
                    "columns": [
                        {
                            "type": "Column",
                            "width": "50px",
                            "items": [
                                {
                                    "type": "Image",
                                    "url": "https://normanhurb-h.schools.nsw.gov.au/content/dam/doe/sws/schools/n/normanhurb-h/icons/alert.png"
                                }
                            ]
                        },
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "Action to take",
                                    "wrap": true,
                                    "separator": true,
                                    "color": "Accent",
                                    "size": "Small"
                                },
                                {
                                    "type": "TextBlock",
                                    "wrap": true,
                                    "spacing": "None",
                                    "text": "@{variables('ActionToTake')}"
                                }
                            ],
                            "verticalContentAlignment": "Center"
                        }
                    ]
                }
            ]
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.OpenUrl",
                    "title": "See the original message",
                    "iconUrl": "https://normanhurb-h.schools.nsw.gov.au/content/dam/doe/sws/schools/n/normanhurb-h/icons/teams.png",
                    "url": "@{triggerBody()?['entity']?['teamsFlowRunContext']?['messagePayload']?['linkToMessage']}"
                },
                {
                    "type": "Action.OpenUrl",
                    "title": "Chat with @{outputs('Get_user_profile_(V2)_-_person_who_typed_the_message')?['body/displayName']}",
                    "iconUrl": "https://normanhurb-h.schools.nsw.gov.au/content/dam/doe/sws/schools/n/normanhurb-h/icons/teams.png",
                    "url": "https://teams.microsoft.com/l/chat/0/0?users=@{outputs('Get_user_profile_(V2)_-_person_who_typed_the_message')?['body/mail']}"
                }
            ]
        }
    ]
}

 


 




Thanks for reading! Hope you’ve learned loads yourself! 



Experiencing Data Access Issue in Azure portal for Log Analytics – 05/06 – Investigating

This article is contributed. See the original author and article here.

Initial Update: Thursday, 06 May 2021 08:16 UTC

We are aware of issues within Log Analytics and are actively investigating. Some customers may experience data access issues and delayed or missed Log Search Alerts in West Europe region.
  • Work Around: None
  • Next Update: Before 05/06 11:30 UTC
We are working hard to resolve this issue and apologize for any inconvenience.
-Mohsin Inamdar