How To Print QR Code Stickers

 

As Registration Chairperson for Stir Trek Conference, this year I was in charge with coming up with a way to print QR code stickers for 2,100+ attendees.  The QR codes would contain name and email address for a registered attendee so that sponsors could have a quicker / easier way to capture contact information for giveaway prizes or sending follow up communications.  Since we care about attendee privacy we also planned for “opt-out” stickers that could cover over the QR code stickers if attendees chose.  In this post I’ll walk through the highlights of how we designed, created, and printed the QR codes stickers.

QRCodeSample.jpg

Designing QR Codes

Before starting this project I was familiar with QR codes, but I never knew the amount of data (or what type) could be encoded in a QR code.  Even more interesting (at least to me) is the science behind how to size the QR code relative to the distance at which the QR code will be scanned.  The following article is from 2011 but gives some insight into scaling the number of characters encoded with the scanning distance.

QR Code minimum size

https://blog.qrstuff.com/2011/11/23/qr-code-minimum-size

QR Code Minimum Size
Modules Characters Scan Distance
150mm (6″) 300mm (12″) 450mm (18″)
25 26 15mm (0.6″) 30mm (1.2″) 46mm (1.8″)
30 49 18mm (0.7″) 36mm (1.4″) 55mm (2.1″)
35 72 21mm (0.8″) 42mm (1.7″) 64mm (2.5″)
40 98 24mm (0.9″) 48mm (1.9″) 73mm (2.9″)
45 125 27mm (1.1″) 54mm (2.1″) 82mm (3.2″)
50 163 30mm (1.2″) 60mm (2.4″) 91mm (3.6″)
55 203 33mm (1.3″) 66mm (2.6″) 100mm (3.9″)
60 249 36mm (1.4″) 72mm (2.8″) 109mm (4.3″)
65 298 39mm (1.5″) 78mm (3.1″) 118mm (4.7″)
70 351 42mm (1.7″) 84mm (3.3″) 127mm (5.0″)
75 407 45mm (1.8″) 90mm (3.5″) 137mm (5.4″)
80 468 48mm (1.9″) 96mm (3.8″) 146mm (5.7″)
85 534 51mm (2.0″) 102mm (4.0″) 155mm (6.1″)
90 601 54mm (2.1″) 108mm (4.3″) 164mm (6.4″)
95 669 57mm (2.2″) 114mm (4.5″) 173mm (6.8″)
100 739 60mm (2.4″) 120mm (4.7″) 182mm (7.2″)

We needed to encode attendee first name, last name, and email address.  After analyzing our registration data the longest combination of those fields was under 125 characters so we could safely scan a 1″ x 1″ sticker from 6″ away.  Since the QR code stickers are put on the attendee badge, the smaller the sticker size the better so that we didn’t take up too much space (or cover the great artwork from Nate Lovett and badge design from Carey Payette).

Label Stickers

Since the stickers needed to be 1″ x 1″ I purchased 100 sheets (80 per sheet / 8,000 total) of the following label stickers for less than $20 USD.  This allowed for many sample prints to ensure images and other information was lined up on the stickers for the final product.

OL5425 – 1″ x 1″ One Inch Square Labels

https://www.onlinelabels.com/OL5425.htm?src=dlc-353

Label template

The stickers came with free downloadable Microsoft Word template for the exact dimensions and layout needed.  One wrinkle to the plan was that our shipping vendor (great folks at Markt custom apparel) would be applying the stickers to the badges as they packed attendee boxes.  As such we needed to print not only the QR code but also a “verification” sticker with attendee name and registration ID number to ensure the right QR code went to the right box.  More on that later using Word’s mail merge to accomplish that challenge.

Generating QR Codes

My primary laptop runs Windows 10 and I was able to find an app in the Microsoft Store called “QR-Code Generator Pro”.  There is a QR code bulk creation functionality in the paid “pro” version.  I exported our registration data (name + email address) from Eventbrite to a suitable CSV format that this app could then encode.

QR-Code Generator Pro

https://www.microsoft.com/en-us/p/qr-code-generator-pro/9nqzgs8wzlh2

Importing QR Codes

For many years I’ve “known” about mail merge but I had honestly never used it for more than 5 mins at a time.  Working with 2,100+ attendees made mail merge a necessity for the scale and complexity of what I needed.  I found the following online article that walks through creating the placeholders in the mail merge template and then linking fields from attendee registration spreadsheet to those placeholders.

2 Ways to Batch Insert Multiple Pictures into Your Word Document via Mail Merge

https://www.datanumen.com/blogs/2-ways-batch-insert-multiple-pictures-word-document-via-mail-merge/

This took much longer than expected due to the sometimes one-way changes that were applied which required starting over from scratch.  I settled on a template that I can now re-use in future years by simply importing the newest attendee data spreadsheet and applying the mail merge.  As mentioned previously needing to print not only the QR code but also attendee verification data meant that the “next record” tag had to appear on every other label in the template.

Printing QR Codes

Printing the QR codes on the label stickers took a number of sample runs before I got them working properly.  At first the QR codes printed slightly off center.  Attempting to adjust the margins on the QR code images proved unsuccessful.  In the future I may look at increasing the (pixel) size of the generated QR codes to compensate for the printing issue.

Conclusion

Overall I’m very happy with the final results and the fact that this is a fairly automated and reusable process.  As always we’ll continue to tweak and refine the process to continue delivering the best we can for our attendees.  If this overview helped save you time, effort, etc. please let me know in the comments or share back improvements.

 

-Frog Out

How To Add PowerShell v7 Preview to the New Windows Terminal

In this quick post I’ll show you how to add PowerShell v7 preview 1 to the new Windows Terminal.

Background

The new Windows Terminal was announced at Build this year and has been available (building from source code yourself) through the Microsoft/Terminal GitHub repo.  A very early preview of the Windows Terminal is now available through the Microsoft Store (link).  I haven’t verified but I believe you’ll need a few prerequisites in order to install.  Out of the box the current preview of Windows Terminal offers:

  • PowerShell Core (v6)
  • Windows PowerShell (v5)
  • CMD (command prompt)
  • WSL (Windows Sub-system for Linux, legacy console)

Solution

After installing the Windows Terminal from the Microsoft Store, open the Settings from the dropdown menu (or click “Ctrl + ,”).

Find the “profiles” element in the settings file and add the following JSON snippet to the array.  Verify the “commandline” and “icon” locations match where PowerShell v7 preview 1 is installed on your machine.

{
"acrylicOpacity" : 0.5,
"closeOnExit" : true,
"colorScheme" : "Campbell",
"commandline" : "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe",
"cursorColor" : "#FFFFFF",
"cursorShape" : "bar",
"fontFace" : "Consolas",
"fontSize" : 10,
"guid" : "{90cbdc15-f4fe-49d2-a245-ec066b70845f}",
"historySize" : 9001,
"icon" : "C:\\Program Files\\PowerShell\\7-preview\\assets\\Powershell_av_colors.ico",
"name" : "PowerShell 7 preview",
"padding" : "0, 0, 0, 0",
"snapOnInput" : true,
"startingDirectory" : "%USERPROFILE%",
"useAcrylic" : false
}

Here is a link to my complete profiles.json for comparison.

After you’ve added the above element you’ll now see PowerShell v7 Preview in your dropdown list of available shells with the proper icon.  For an added bonus I also added Zsh (with the Oh My Zsh framework for auto-suggestions and more) based on seeing demos from Jeff Hollan showcasing that shell.

WT PS v7 preview-1

Below screenshot shows PowerShell v7 Preview in use and verifying the PSVersion.

WT PS v7 preview-2

Conclusion

I’m very excited to begin using the Windows Terminal more in my daily tasks.  Being able to switch back and forth between multiple shells (specifically PowerShell v5 and v6/v7) is possible in Visual Studio Code but this will be a much easier solution for many of my scenarios.  Hopefully someone else will find this helpful as well.

 

-Frog Out

How To Self Destruct Azure Resource Groups with Alert and Logic App

I was reading a blog post by Mark Heath on This resource group will self destruct in 30 minutes which leverages an open source Azure CLI extension to automatically delete resource groups.  This extension accomplishes the deletion by scheduling a logic app in the same resource group.  I was curious if I could accomplish the same effect without the need to leverage the Azure CLI (i.e. for any resource group created via portal, PowerShell, etc.)  In this post I’ll show how to configure a “self destruct” mechanism using an Azure Alert and a Logic App.

Solution

Here are the high level steps to follow.

  1. Create Resource Group – Create resource group will host the subsequent resources
  2. Create Logic App – Create logic app to trigger on Azure Activity Log HTTP request (will fill out more later)
  3. Activity Log alert – Create Azure Activity Log alert to trigger logic app
  4. Trigger Alert – Create resource group which triggers Activity Log alert and consequently logic app
  5. Gather JSON schema – Get JSON schema for HTTP request sent to logic app
  6. Finalize Logic App – Add JSON schema from alert HTTP request and action to remove resource group to logic app

1) Create Resource Group

If you don’t already have one, create a resource group to host the resources for the self destruct solution.

2) Create Logic App

Create a logic app in the resource group from previous step.  Add a trigger for When a HTTP request is received.  We will not fill out any of the details for the trigger at this time.  Click Save.

AzureRGSelfDestruct8.jpg

3) Activity Log alert

Navigate to Azure Monitor (can search from the top search bar or go through All Services) for the subscription where the solution will be deployed.

AzureRGSelfDestruct10.jpg

Click Alerts on the left hand navigation.  Click New Alert Rule.

AzureRGSelfDestruct11

Define the resource to be monitored:

  • Resource:
  • Condition:
    • Signal Type: Activity Log
    • Monitor Service: Activity Log – Administrative
    • Signal Name: Create Resource Group (subscriptions/resourceGroups)
    • Alert Logic – Status: Succeeded
  • Action Groups:
    • Action Group Name: SelfDestructResourceGroup
    • Short Name: SelfDestruct
    • Subscription:
    • Resource Group:
    • Action Group Action: LogicApp
      • Subscription:
      • Resource Group:
      • Logic App:
AzureRGSelfDestruct2.jpg
Condition – configure signal logic part 1
AzureRGSelfDestruct3.jpg
Condition – configure signal logic part 2
AzureRGSelfDestruct13
Create new alert action group with a logic app action
AzureRGSelfDestruct4.jpg
Create a new alert action to go in action group
AzureRGSelfDestruct5.jpg
Overview screenshot for rule creation

4) Trigger Alert

Create a new resource group that will then trigger the alert defined in step 3 and consequently fire the HTTP trigger for the logic app defined in step 2.

5) Gather JSON Schema

Navigate to the logic app defined in step 2.  Assuming the logic app was successfully triggered, under Run history select the successful logic app execution.  On the “logic app run” screen expand the trigger and click on Show raw outputs.

AzureRGSelfDestruct14

Save this JSON for use in the next step.  If you are unable to collect this JSON schema you can use the sample below which is already coverted to the final format needed.

Note: the resoureceGroupName element is buried many levels deep.  We will query for this when needed.

{
“properties”: {
“body”: {
“properties”: {
“data”: {
“properties”: {
“context”: {
“properties”: {
“activityLog”: {
“properties”: {
“authorization”: {
“properties”: {
“action”: {
“type”: “string”
},
“scope”: {
“type”: “string”
}
},
“type”: “object”
},
“caller”: {
“type”: “string”
},
“channels”: {
“type”: “string”
},
“claims”: {
“type”: “string”
},
“correlationId”: {
“type”: “string”
},
“description”: {
“type”: “string”
},
“eventDataId”: {
“type”: “string”
},
“eventSource”: {
“type”: “string”
},
“eventTimestamp”: {
“type”: “string”
},
“httpRequest”: {
“type”: “string”
},
“level”: {
“type”: “string”
},
“operationId”: {
“type”: “string”
},
“operationName”: {
“type”: “string”
},
“properties”: {
“properties”: {
“responseBody”: {
“type”: “string”
},
“serviceRequestId”: {},
“statusCode”: {
“type”: “string”
}
},
“type”: “object”
},
“resourceGroupName”: {
“type”: “string”
},
“resourceId”: {
“type”: “string”
},
“resourceProviderName”: {
“type”: “string”
},
“resourceType”: {
“type”: “string”
},
“status”: {
“type”: “string”
},
“subStatus”: {
“type”: “string”
},
“submissionTimestamp”: {
“type”: “string”
},
“subscriptionId”: {
“type”: “string”
}
},
“type”: “object”
}
},
“type”: “object”
},
“properties”: {
“properties”: {},
“type”: “object”
},
“status”: {
“type”: “string”
}
},
“type”: “object”
},
“schemaId”: {
“type”: “string”
}
},
“type”: “object”
},
“headers”: {
“properties”: {
“Connection”: {
“type”: “string”
},
“Content-Length”: {
“type”: “string”
},
“Content-Type”: {
“type”: “string”
},
“Expect”: {
“type”: “string”
},
“Host”: {
“type”: “string”
},
“User-Agent”: {
“type”: “string”
},
“X-CorrelationContext”: {
“type”: “string”
}
},
“type”: “object”
}
},
“type”: “object”
}

6) Finalize Logic App

Edit the Logic App.

Inside the HTTP request trigger either…

  • click “sample payload to generate schema” paste in your sample JSON payload from step 5.

-or-

  • paste the sample I provided into the Schema input.

Next add an action for Delete a resource group (currently in preview at time of writing).

AzureRGSelfDestruct12

Fill in the following values:

  • Subscription:
  • Resource Group: Expression = “triggerBody().data.context.activityLog.resourceGroupName”

AzureRGSelfDestruct7.jpg

The final logic app will look similar to the following:

AzureRGSelfDestruct6.jpg

Test Solution

Test out the solution by adding a new resource group to the monitored subscription.  Check the Azure Monitor alerts to see if the Activity Log entry for successful resource group creation triggered the Logic App.

AzureRGSelfDestruct16

Then verify the logic app execution history shows the resource group deletion was successful.

AzureRGSelfDestruct15

Next steps

More than likely you will not want to delete the resource group right after you create it.  In that case you can add a Delay action which pauses the logic app for a specified number of minutes (ex. 60 minutes).  Additionally you could apply conditional logic to check if the name of the resource group matches (or doesn’t match) a specific pattern.  There are many additions you can add to personalize this solution to your needs.

Conclusion

In this post I walked through an adaptation of the Azure CLI extension that Mark Heath linked to.  We leveraged an Azure Monitor alert together with a logic app to provide an option to self destruct any resource group no matter where or how it was created.  If you have any feedback or additional suggestions feel free to leave them in the comments.

-Frog Out

Windows Equivalent of Linux or Unix “Touch” Command

In Linux and Unix there is a “touch” command which will update the timestamp of a file without modifying the contents.  You can also create an empty file without having to open an application among other actions.  In Windows there isn’t a direct equivalent, but you can get close by using the “copy” command with a “+” at the end of the filename while specifying no destination file.  The + symbol points the copy operation back to the source file.  This will update the timestamp while not modifying the contents of the file.

Ex.

copy SampleFile.txt+

WindowsEquivTouch1

WindowsEquivTouch2

This process was helpful for my customer testing out automated CI/CD processes with Azure DevOps and Git.  Hopefully this will be useful to someone else.  Enjoy.

 

-Frog Out

Sample Deploying Multiple Azure ARM Templates Using External Links

In this post I’ll share a set of linked Azure ARM templates (link) that can be used to deploy a number of Azure resources together.  This sample uses externally linked ARM templates using a parent to child relationship as well as including a few “complex” scenarios like conditional logic and assigning permissions through role assignments.  Note there are also two ways to deploy these templates: 1) at the subscription level (owner) and 2) at the resource group level (contributor).

<Update 2019-04-09>After reading this article on ARM template lifecycle management do’s and dont’s I’m rethinking using externally linked ARM templates.  Below example still contains them but I may update to combine into a single ARM template at a later date once I’ve had a chance to test.</Update>

Background

For a recent customer project we had a need to deploy the following resources.

  • Resource group
    • Azure Storage Account
    • Azure Function App
      • Azure Application Insights
    • Azure Log Analytics workspace
    • Azure Automation Account

A few of these resources have dependencies on each other such as the Function App requiring a storage account to store solution data into blobs / queues, Automation Account requiring Log Analytics for pushing diagnostic stream data to a workspace, etc.  While it is possible to deploy all of these resources in one (very) large ARM template, we also wanted to be able re-use pieces and parts of this solution in future projects that are going to have a similar (but slightly different) architecture.  We decided to create a set of parent-child ARM templates to mimic the first 2 levels of the above hierarchy.

Solution

The sample files are stored in my Blog-Samples repo under the ARM-External-Templates folder.  There is a brief README file to walk through the necessary steps to update parameter files, upload the linked templates to a storage account, etc.  This is not a fully documented process at the moment but if you wish to submit a PR or open an issue I’ll update more as I have time.

A few key pieces to highlight.

  • The “Contributor” scenario assumes that the deployment account has contributor permissions to a specific resource group or subscription (more common for production or similar environments)
  • The “Owner” scenario assumes that the deployment account has owner permissions to the entire subscription (ex. development environment)
  • The “Owner” scenario optionally deploys role assignments (queue sender, workspace reader, and runbook operator) to various resources only if the corresponding parameter values are not empty (otherwise skip assignment)
  • The Automation Account is pre-populated with a PowerShell runbook and also configured to send runbook job and stream output to the provisioned log analytics workspace

Sample output

After running the deployment script the deployment and resource group should look as follows.

LinkedARMTemplates1.jpg

LinkedARMTemplates2.jpg

 

Conclusion

The linked ARM templates from this sample are meant for illustration purposes only.  Hopefully you’ll find them helpful in terms of what is possible from a deployment and configuration perspective.  If you have any feedback or suggestions please submit a PR on the repo or open an issue on GitHub.  Good luck with automating your Azure deployments.

 

-Frog Out

PowerShell Script to Find Connectors from PowerApps Apps

In this post I’ll share a script I developed for a customer to find which connectors are used by which PowerApps apps.  Currently this is not something available through the Power Platform Admin Center.  Feel free to use this script as you see fit.  This script is provided as-is without any warranties of any kind.  If you update or adapt it and decide to re-post please provide attribution.

Script

Note: If you do not see the below Gist please refer to code at this location: PS-Get_PowerApps_App_Connections.ps1

Sample output

image.png

You may notice that the output contains a complex property for the Connections.  It has been some time since I worked with formatting output in PowerShell.  If you have an improvement to the formatting please share back suggestion and I’ll update the sample script.

-Frog Out

Looking Ahead To 2019

In this post I’ll look ahead at what I have coming up in 2019 and what I look to accomplish.

Background

In previous years I have typically blogged at the start and end of the year about my goals and retrospective.  In mid-2018 I started capturing a monthly retrospective (see How I Do A Personal Monthly Retrospective).  While I’m doing these personal retrospectives more frequently (monthly vs. yearly) they usually contain more personal things than I would feel comfortable sharing publicly.

Ahead in 2019

Baby number 3

The biggest thing I’m looking forward to in 2019 is that my wife Sarah and I are expecting our third child later this year.  We’re finally starting to share the news outside of our immediate family.  I’m very excited and happy that our family is growing and I look forward to sharing our love with our new baby.

Exercise

For the past several years I’ve been running a few 5k races, quarter marathon races, and obstacle course / mud runs.  This has been a good way to push myself to stay active and healthy.  This year I’ve already signed up for a 5k and an obstacle course race in the first half of the year.  I’ve already started training for both and it’s amazing how much better I feel physically and mentally after getting into a good workout routine.  I find that I have more energy and motivation to accomplish things and hope that I can keep this up in the coming months.

Faith life

My Catholic faith has always been a big part of my life, but this year especially is an important year as my wife is preparing to enter fully into the Catholic Church.  I’m proud to support her on her faith journey as well as continuing to raise our children in our shared faith.

Technical leadership

In 2018 I went through a program at Microsoft called Technical Leadership Development Program (TLDP).  The purpose of this program is to identify individual contributors (ICs, not a manager of people) and grow their technical leadership skills to make a bigger impact inside and outside the company.  While there were many takeaways from this program one of the big ones for me was the following progression of stages (starting at bottom and going up) for a technical leader:

Technical Leaders…

    • Stage 4 – Drive Impact Through Strategy
    • Stage 3 – Drive Impact Through Others
    • Stage 2 – Master Individual Impact
    • Stage 1 – Grow Individual Impact

 image

At the start of 2018 I would estimate that I was in the 2nd stage of mastering individual impact and not realizing (at the time) that the next stage was to move onto driving impact through others.  Note that this progression to stage 3 doesn’t require moving into people management.  Instead you can remain an individual contributor while still increasing impact through other people.  I tested the waters with this process through the 30 Days of Microsoft Graph blog series and a few other side projects.  I’m looking forward to continue this progression in 2019.

Reading books

Each year on average I read 2-4 books, usually during slow weeks around holidays when I can devote more attention.  In the past year I’ve found a number of great books in a number of topics including science fiction, religion, and technical leadership.  I should probably join a Good Reads program but have not done so yet.  Instead I usually end up hearing about a good book recommendation from a friend or coworker and then picking it up from the local library, borrowing from a friend, or similar.  I’m not always able to reserve time each day / week, but I do find that I sleep better when I read for at least 10+ minutes before going to bed.

Conclusion

These are the things I’m currently looking forward to in 2019.  Thanks to my mentor Sean McDonough for urging me to get this written.  I know much will change throughout this year, especially once baby #3 arrives.  Here’s to a successful start to the year and continued growth.  If you have your own goals or plans for the year please share in the comments.

-Frog Out