We all need to automate more

A common challenge today many business, including IT resellers, face is the lack of suitably qualified staff. There seems little doubt this situation will continue for an extended period due to various reasons. However, I believe the situation has been greatly exacerbated by many businesses failing to truly embrace the power of automation, especially IT automation, in their business.

A common process I see in many businesses undertake is simply adding more technology without the drive for improved effectiveness. Many business seem to add more technology because they ‘believe’ it will make them more effective. However, unless there is a plan and desire to become more effective it rarely happens. In reality what happens is, they become less effective, as technology systems add increased burdens, costs and demand more resources. In many cases, they make things far worse and introduce more inefficiencies due to complexity and a lack of integration.

If you take a step back and look at the wider picture here, it was a common belief that computers and technology systems in general would remove the mundane burden of repetitive and undesired work in our society. However, if you look around today most people and businesses are far more stressed, are far more ‘time poor’ than they have even been and yet we have all this wonderful and powerful technology at our finger tips. We carry super computers in our pocket, but when was the last time everyone turned up to a meeting on time?

One of the reasons I suggest is that fact that most are merely using the ‘system default’ configuration that comes with any technology. They don’t invest in learning and exploring how to make the technology work best for them. Technology developers can only supply their products with a single configuration that ‘hopefully’ suits most users. That is rarely the case. Unfortunately, merely ‘accepting the defaults’ leads to inefficiencies which leads to being more time poor, which leads to less time being available to learn and optimise technology, which leads to merely ‘accepting the defaults’…. and so on through an ever more inefficient spiral.

Another reason is the fact that today we live a very much ‘now’ society. People don’t want to wait. They want instant gratifications. The days of investing for the long term no longer take primacy, which is strange, given that things like compound interest have been referred to by some pretty smart people as the eighth wonder of the world.

“Compound interest is the eighth wonder of the world. He who understands it, earns it … he who doesn’t … pays it.”

― Albert Einstein

Unfortunately, this fallacy of constant technology efficiency is unlikely to change. I would actually contend that it is, in fact, only going to accelerate. That, however, does present an opportunity for those who are prepared to invest some time and truly take advantage of what things like automation can achieve.

I like to think of technology automation along a spectrum. In the past, we have had things like scripting such as PowerShell that provides a huge mount of leverage. You can write a PowerShell script to do just about anything in the Microsoft environment these days. It allows a single person to obtain a consistent result once it has been developed. The problem is however, someone still needs to run that script. If an IT reseller is managing an environment for a customer, that customer can’t run the script themselves, they need to get the IT reseller to run that script. That is still not as efficient as it could be. It also centralises the power of automation, placing it in the hands of a small, technically savvy audience.

Next on this spectrum is the automation we see today in technologies like the Power Platform that allow an army of citizen developers to easily create ‘low-code’ solutions for business challenges. This means that most customers using Microsoft 365 have this capability. You can also see Microsoft raising the awareness of this audience to the possibilities without the need for dependencies on IT resellers to run these automation processes. Sure, they solutions developed by ‘citizen developers’ may not be as elegant as those created by a skilled developer, but does that really matter any more if it gets the job done? A growing army of people entering the workplace are ‘digitally native’ and more than willing to ‘try’ technology. By doing so, using the Power Platform, they are not only solving business challenges but they are increasing their own skill and career value.

Where I think we are going is to a world where automation are wrapped up inside a bot or something like Power Virtual Agents. Recently, I wrote this article:

Automated user tenant access control

In essence, it allows you to control when users can login to a Microsoft 365 tenant. Even thought this solution was created using Power Automate, it still needs someone to execute it if perhaps you wanted to use it when an employee goes on leave. The friction is much lower than using a PowerShell script, but it still could be better.

Think about wrapping this tenant access control solution inside a Power Virtual Agent bot and having that published to a channel in Teams. Then, when a user wants to take leave, they converse with the bot for approvals as well as automating the process of denying access while they are away. The bot can ensure that all the correct information is collected and correct processes are followed and documented, every time! Most importantly, this puts the power of automation in the hands of the people that use it. Using a bot, it does this in a friendly a conversational manner. It doesn’t introduce IT complexity to scare the end user away from actually using it. There are lots and lots of benefits.

The good news is that there are already lots of automation options you can take advantage of. The bad news is that you are unlikely to using them enough in your business. A modern approach to staff shortages shouldn’t be ‘where do I get good staff’. Instead, it should be ‘how can I automate more to reduce that dependency’.

Without doubt, the best place to start for most ‘non-IT’ types is the Power Platform in Microsoft 365. Yes, there is an upfront investment to be made, but like compound interest it will produce significant returns over time.

There are real opportunities for smart businesses to leverage the automation capabilities already inside most systems today. These are available to all but the smart ones will take them, implement and transform their impact on the market and their own businesses. Let’s put technology to work to do thing it supposed to do. That is, to make our lives easier and better, not simply as adding more that we don’t need. Simplicity is truly the effectiveness superpower.

Using Power Automate to send SMS

I recently had the need to send an SMS programmatically. The reason I wanted to be able to do this si because Microsoft Bookings currently doesn’t send SMS reminders to attendees of a booking outside the US. That means, here in Australia, I needed to add the capability via another SMS integration option.

The most obvious choice, once again, is Power Automate. To handle the SMS component I needed to work with a SMS provider. The one who came to party was Mondotalk.

The first step was to consult the Mondotalk API to discover how to send an SMS using code. Luckily, their documentation contained a handy PowerShell script:

$messagebody1 = @{

id = $id

key = $key

username = $username

password = $password

to = “<phone>”

sender = “<phone>”

msg = “hello world”

replyto = director@ciaops.com

}

$url = <API url>

Invoke-RestMethod -Method POST -Uri $url -Body $messageBody1

In essence you create the body of the API request using an array and then you simply POST that to the API URL. Pretty straightforward and after I worked out all the variables like username, id and key, I had this working.

image

The key action is HTTP as shown above. It is important to remember that this a ‘premium’ connector and you may need a more advanced license to use this.

Initially, I thought I’d just bung in the parameters into the HTTP action as I have done before and it would be good to go. Not the case as it turned out. Everything I tried came back with a variation of the following error:

{“_meta”:{“status”:”ERROR”},”records”:{“errorCode”:401,”userMessage”:”Must login or provide credentials.”,”devMessage”:”Please provide credentials by either passing in a session token via cookie, or providing password and username via BASIC authentication.”,”more”:null,”applicationCode”:”Unauth:1″}}

In essence, the API is failing to login to my account to send the SMS. The PowerShell worked fine but Power Automate didn’t.

The solution ended up lying with adding a header field to the HTTP action:

Content type: application/x-www-form-urlencoded

and formatting the body with an ‘&’ between the fields i.e:

username=#####&password=*******&to=61######&id=#####&key=<GUID>msg=hello&replyto=director%40ciaops.com&sender=61########

as well as setting the authentication in the HTTP action to None as it was being done in the body of the request.

After all of that, I finally had success. The lesson here is that APIs don’t always want JSON!

image

I then decided to wrap a Power Virtual Agent bot around the Flow and publish it into a Team to allow users to send SMS directly from Teams. They simply use a key phrase to call the bot and tell it when number to send to. The bot passes those details to the Flow and runs what I had worked out previously

image

The only change here from the initial on demand Flow was the passing of a variable into the Flow from the bot and creating the body of the API request, also as a variable.

image

Again, it is important to get the body field in EXACTLY the right format for the API request when it is created.

So, that’s how you connect an SMS API gateway to Power Automate and Power Virtual Agents. The real trick was getting the right format of the API POST request which had to be deduced from the documentation. Hopefully, sharing that process here gives others a shortcut to getting it working in their environments because it took me a LONG time to work it out!

Thanks again to Mondotalk for being kind enough to give me a demo account and assist getting this working.

Displaying a percentage with two decimal places in Power Automate

image

In this section from my Power Automate I initialise two variables (currentscore and maxscore) with values using the Set variable action. I want a third variable, sspercentage, to be equal to:

(currentscore) / (maxscore) * 100

that is, a percentage but with only two decimal places. To do that I need to use the following formula in the Set variable 3 action:

formatNumber(mul(div(variables(‘currentscore’),variables(‘maxscore’)),100),’0.00′,’en-US’)

which you will note, if you look carefully, actually results in sspercentage being a string not a float!

(div(variables(‘currentscore’),variables(‘maxscore’))

handles the division

mul(div(variables(‘currentscore’),variables(‘maxscore’)),100)

multiples the division by 100 to get the percentage value.

The 0.00 in the formula is the actual formatting that you can adjust if you need and the en-US is the language format for the number. The Microsoft reference is for the formatnumber function is here:

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formatNumber

The end result looks like:

image

If the formatnumber function is not used then the result contains a lot of numbers after the decimal place and remains of type float, which I would only need if I wanted to display the value of Pi!

CIAOPS Need to Know Microsoft 365 Webinar – May

laptop-eyes-technology-computer

Join me for the free monthly CIAOPS Need to Know webinar. Along with all the Microsoft Cloud news we’ll be taking a look at OneDrive for Business.

Shortly after registering you should receive an automated email from Microsoft Teams confirming your registration, including all the event details as well as a calendar invite.

You can register for the regular monthly webinar here:

May Webinar Registrations

(If you are having issues with the above link copy and paste – https://bit.ly/n2k2205 – into your browser)

The details are:

CIAOPS Need to Know Webinar – May 2022
Friday 20th of May 2022
11.00am – 12.00am Sydney Time

All sessions are recorded and posted to the CIAOPS Academy.

The CIAOPS Need to Know Webinars are free to attend but if you want to receive the recording of the session you need to sign up as a CIAOPS patron which you can do here:

http://www.ciaopspatron.com

or purchase them individually at:

http://www.ciaopsacademy.com/

Also feel free at any stage to email me directly via director@ciaops.com with your webinar topic suggestions.

I’d also appreciate you sharing information about this webinar with anyone you feel may benefit from the session and I look forward to seeing you there.