Getting started with VS Code – for a developer wannabe – Part 1

I am a developer… in the same was as I am a gamer and a harmonica player… I really, really really want to be one… I am not good at it, but I really want to be one. I have over the years tried my hand at Powershell, Yaml, BAT- files and even good old kix scripts and much lite an amateur golfer I try to tell my self that if I just have the right tool I will really get good at this… (I really want to believe that 🙂 )

When it comes to PowerShell I have been an avid user of PowerShell ISE but since Microsoft is not doing much of anything with ISE anymore and they are pushing VS Code more and more for everything I thought what the heck… This is my noob guide to getting started with VS Code (for someone that has only used ISE).

In this post I will show you how I set it up and I will probably follow up wit other posts on how I got started.

First you need to download and install VS Code itself:

  1. Go here to download
  2. I checked the options
    Add “Open with Code” action to Windows Explorer file context meny
    Add “Open with Code” action to Windows Explorer directory context meny
    Register Code as an editor for supported file types
  3. Finish the install and Launch VS Code

When you start VS Code for the first time it will look like this. To get started with PowerShell there is at least one plugin you will need… PowerShell (unexpected right). This is used for providing snippets and high lighting code

4. Click the small cubes at the bottom of the toolbar on the left

5. Type PowerShell in the search bar, select it and press the small green install

The plugin even makes VS Code look a bit like ISE. I usually set it back to Dark (that is what coders do 🙂 )

That is it for today. I will continue with more tips and tricks for getting started with VS Code.

Bye

Johan

Creating an App Password for a Azure AD Account using the Office 365 Portal

Most organizations today are using Azure AD and the absolute recommendation is to use 2FA in as many scenarios as possible… in some that is not possible… then there is an option to use an application password (this should be uses in special cases and you should never use it on an Admin Account). To create an App Password you do the following:

  • Log in to https://portal.office.com
  • In the upper right corner click your profile picture and select “My Account”
  • Go to “Security and Privacy” and click “Create and manage app passwords”

Note: If you are not able to see the Additional Security verification you can go directly to the link: https://account.activedirectory.windowsazure.com/AppPasswords.aspx … here you can create an app password.

  • To create a new app password click create

Links:
https://docs.microsoft.com/en-us/azure/active-directory/user-help/multi-factor-authentication-end-user-app-passwords
https://community.spiceworks.com/topic/2034065-issues-with-o365-app-passwords

Projecting to a Windows PC in 2019

There used to be this app by default in Windows 10 called Connect… this was a brilliant app for all of us presenting things once in a while. The app enabled you to show your phone screen on your PC screen to be able to show it on a projector.

Today one of my colleagues asked me how to do this and I thought I would write a short decription… and low and behold… I could not find Connect!!

After some fiddeling I found that it is now an optional feature. To install it go to Settings and search for Projecton Settings. Click the “Optional Features” link.

Click Add a feature, search for wireless display, check it and click Install

Now the Connect app exists in the start menu, you can start it and connect to tour PC.

That is all for today…

Johan

Flow Friday: Posting Azure VM Auto Shutdown notifications to Microsoft Teams

When you have Azure VMs up and running there is a function to auto shut them down when they are not being used. You can do that in a couple of ways. One of the newer ones is to use the Azure DevTest Labs functionality to do this. Half an hour before the VM is shut down Azure sends an email to a pre-defined adress where you have the option to post-pone or cancel the shutdown.

Today one of my colleagues asked me if it was possible to get this email, with the links, into Teams. My first thought was to send it to the Teams Channel email. Unfortunately did not display correctly…

My next try was to use the Webhook in DevTest Labs functionality and the incoming webhook connector in Teams. When I did this the message did not look very “user friendly”

So I thought I would give Power Automate a try. I set up DevTest Labs to send the email to my mailbox. The I creating a trigger for an incoming email and with a filter for the email adress that Azure DevTest Labs user

The I add a block posting to Teams Channel. In order to get it to work I had to cut down the message to size. I used the title tag in the email and the phrase “Note that” at the end of the message to cut away the beginning and the end of the message body to fit the message in the Teams post.

The Expression:
substring(triggerBody()?[‘Body’],indexOf(triggerBody()?[‘Body’],'<H1′),sub(indexOf(triggerBody()?[‘Body’],’Note that’), indexOf(triggerBody()?[‘Body’],'<H1′)))

Finally I move the message to my Archive folder.

The message is now in Teams 🙂

Installing Hass.io on a Raspberry Pi 3 with a RaZberry Z-wave card

I was helping a friend today getting his Raspberry Pi prepped for running Hass.io. He mentioned that he could not get it to boot correctly and thought that it had to do with his laptop not being able to create the boot image correctly so I thought I would see it I could help.

Turned out the issue was not the image… When I opened the lid of the Pi I noticed that it had a RaZberry card installed… so I did what any PC tinkerer with a non-booting PC does… rip everything out and start with the bare essentials. Presto… it booted 🙂

Apparently the built in Bluetooth on the Pi 3 is interfering with the RaZberry card and you have to tweak the HassOS image in order to get it working.

First you add this to the config.txt in the root of the boot volume (you need to insert the card in a PC)

dtoverlay=pi3-miniuart-bt

And then you add the following to the configuration.yaml file of Hass.io (the easiest way I found to get to it is installing the Samba plugin from whitin Hassio)

zwave:
  usb_path: /dev/ttyAMA0

And then it boots… Happy Days

/Johan

Links
https://www.home-assistant.io/hassio/zwave/
https://www.automatiserar.se/razberry-och-z-wave-me/#Vad_Behovs

Friday Flow: Using Microsoft Forms with Power Automate

At the company where I work we regularly have knowledge transfer sessions called Brown Bag Lunches (BBLs) which I think is a great way to share and give back. I am in charge of scheduling these.

I wanted automate the process for planning these sessions and give my colleagues a way to submit suggestions for content. I started by setting a simple Microsoft Form for them to add suggestions

Sorry about the Swedish 🙂

Microsoft has a page for looking at the results of the form submissions which I could have used to get the subjects and plan them manually… but where is the fun in that :-). My solution was to add a flow that is triggered every time a form is submitted which adds it to an excel spreadsheet and adds a todo task in my todo list of choice Todoist.

The result from Forms is in a JSON format so the first thing we need to do is to parse the JSON message.


The parsing of the JSON also means that we can use the content as dynamic content and add it without having to write an expression… the No-Code way. The JSON message also only contains the response id so we will have to use a “Get response details” block to get the actual information of the form.

The reason we are extracting the information is to put it in the Excel file… The response only contains the submitting users email adress so to get the excel file to look a bit nicer I use the Get User Profile block to look up the users real name from the Azure AD/SharePoint. This is a really cool block since it can get a whole lot of cool info from you organization such at a users manager etc.

Finally I add a line to an excel file and put a reminder i my todo list

I would really continue building this logic to automate the planning even further… I might have to revisit this in a later post 🙂

Have a nice weekend

Johan

Getting Workflow Editor and Management Reporter Editor to work in Chromium Edge

When running Dynamics 365 for Finance and Operations there are some legacy software built in. These are packaged as ClickOnce applications and will be downloaded every time you run them. In Internet Explorer and the old version of Microsoft Edge this worked out of the box since these are .Net aware out of the box. When is comes to the all new chromium based Microsoft Edge and Google Chrome this is not the case. In order to get these working we will need a plugin installed in the browser.

For Microsoft (Chromium) Edge
To install in Edge the process is almost the same as for Google Chrome but with an additional steps prior to starting

  • Now go directly to step 3 below

Tip: you can bookmark the URL to the Google Chrome Store to have it around

For Google Chrome
1. Go to the Chrome Web Store by going to Extensions in the Settings menu

2. Click the Chrome Web Store at the bottom of the page

3. Search for ClickOnce and Install ClickOnce for Google Chrome

Verify all installed hotfixes in AX 2009

Today I need to handle an older system… I need to verify if a hotfix is installed in and older AX 2009 system. I found this instruction online (link below): Here is another way to get the list of installed KBs in AX 2009:

  1. Start the AOT (Ctrl + D)
  2. Go to Classes – SysHotfixManifest and expand it
  3. Select a methods and press Ctrl + A to select all methods
  4. Right-click and click Add-Ins – Copy – Name
  5. Paste into Wordpad (Notepad does not handle the CRs very well)
  6. Search for the KB number you want to find

That’s it

Johan

Links
https://community.dynamics.com/ax/f/microsoft-dynamics-ax-forum/76061/finding-which-hotfixes-are-installed/212528

Issues with blocked cookies in Chromium Edge

I have an issue with cookies… And I do have an issue with real cookies… especially oat cookies… but we will not go into that today.

Today we are talking about browser cookies. Sometimes they are sort of creepy and sometimes they are absolutely essential for things to work. I ran inte one of the latter this week and I thought I had allowed all cookies for the specific site. Turns out I did not.

The site in this case is a customers help desk system and I had added the domain but I still got an error saying I needed to enable cookies. In order to find which cookies to allow you just do the following:

  1. Click on the padlock to the left of the adress bar
  2. Select Cookies
  3. Go to Blocked
  4. Select the items in the list one-by-one
  5. Click Allow

Note: This is of course not the customers site… this is my WordPress site for illustration

Flow Friday: Troubleshooting ‘shared_sharepointonline’ doesn’t exist

When trying to build a flow yesterday I got a confusing error:

Unable to process template language expressions in action ‘Create_Sprint_Period_in_Sharepoint’ inputs at line ‘1’ and column ‘2778’: ‘The template language expression ‘json(decodeBase64(triggerOutputs().headers[‘X-MS-APIM-Tokens’]))[‘$connections’][‘shared_sharepointonline’][‘connectionId’]’ cannot be evaluated because property ‘shared_sharepointonline’ doesn’t exist, available properties are ‘shared_office365, shared_todoist’. Please see https://aka.ms/logicexpressions for usage details.’.

The reason for this error is that you are test running the flow using data from a prior test from before you added the missing component (in this case sharepoint). You simply need to trigger the flow again med fresh data and it will work

Johan