finally Microsoft certified, again

Well, it’s just about three months since I committed to taking the exam for Microsoft’s PL-900 certification. Per this post, I got an exam voucher from my company, back in March. At that time, I set a “next week” reminder flag on that email in Outlook, and I’ve just been kicking the reminder to “next week” again every Friday. So finally I decided to just stop putting it off and take the test today. (It helps that it was a quiet day, with nothing else on my calendar.)

I have a few observations about the exam-taking process that I thought I’d share, since I wasn’t at all sure how it was going to work, so maybe this will help someone else who is planning on taking a Microsoft exam.

First, I wasn’t sure if I should go for the at-home option or go to a testing center. I checked Pearson’s site for local testing centers, and there’s one that’s about 10 miles away from here. So not too far, but far enough that I thought I’d try the at-home option instead.

At-home, of course, was not an option the last time I took an exam, back in 2010. I’d heard some worrying things about the requirements for at-home tests, which I wasn’t sure I’d be able to fulfill. They want to minimize cheating, of course, so you have to take photos of your work environment, to show that you don’t have any reference material at hand. My apartment is so cluttered that I wasn’t sure I’d be able to do that. But I managed to clear everything off my kitchen table, and I guess the photos I took were good enough for them.

But to back up a bit, first I had to schedule the exam. I know that there’s supposed to be some human review/monitoring of the exam, so I wasn’t sure if it would be easy to get a spot, but it turned out to be quite easy to schedule the exam for today. If I’d wanted, I could have taken the exam right away. I didn’t want that though, so I scheduled it for 1:45 PM. You need to check in for the exam prior to the start time, and you can do that 30 minutes prior.

After registration, I went through the “pre-flight check” that involved downloading a small program to my computer and verifying that my webcam and microphone worked, and that my internet connectivity was good enough. That was no problem.

After that, I spent some time taking (and failing) the MeasureUp practice exam again. Given that I’ve never successfully passed the practice exam, I really wasn’t sure I’d be able to pass the real one.

So at 1:15 PM, I went ahead and checked in for the exam. That process takes a while, and requires you to go through the webcam and microphone check again. Then it requires you to take some photos on your phone. They need a photo of your face, your ID (front and back), and four photos of your workspace. That all went smoothly enough. There’s no phone app for this; it’s all done through a website, which you can get to through a QR code or a text message link.

Once you’ve done all that, you have to put your phone away, so it’s out of reach, then you get put into a queue to start the test. I’m guessing that a human needs to manually review your photos and OK them. Or maybe it’s all fed into an AI thing, and only manually reviewed if the AI fails. I don’t know. It took a while for me to get out of the queue, and there were a couple of notices about connection issues that worried me a bit. But eventually I got through and the test started.

I kind of thought that there might be some required human interaction before the test, either in chat or onscreen via webcam/mic, but there was none. I just got transferred into the test.

There weren’t any unexpected surprises in the test itself. The questions were all pretty similar to what I’d seen in the practice exams. It took me about 30 minutes out of the 45 allowed to finish. And I got my results onscreen right after the exam.

I passed by a pretty reasonable margin, I think. I guess that result is a combination of (1) taking the real test more seriously than the practice tests, (2) having learned something from my repeated practice test failures, and (3) the practice tests being purposely harder than the real test.

So, post-exam, I went to the MS Learn site and downloaded a little PDF certificate, showing that I passed. I couldn’t initially find a detailed report on my score, but I just went back and checked again, and it’s there, on Pearson’s site. So my actual score was 822, where 700 was passing. Info on the scoring and the reports can be found here. I guess that’s 822 out of 1000, so… good enough.

I guess the next step here is to boast about passing the exam on social media. I think there was something on LinkedIn at one point where you could link your MCP profile to LinkedIn and then post a verified link to show that you’ve actually passed. I’m not sure if that’s still there, or if I’m even remembering that correctly. So I’ll want to look at that. And I kind of remember at one point that if you tagged MS Learning in a tweet about passing an exam, they’d retweet it and congratulate you. So I should see if I can do that. (Though I’m mostly staying off Twitter these days, for obvious reasons…)

I’ve already sent the scoring report to the person at my company that sent me the exam voucher. I guess that having a certain number of certified professionals on staff does something to help us maintain our partner status, or something like that. I know that we keep track of it.

I don’t really get much, personally, out of passing this exam. I’m not looking for a new job, and if I was, it wouldn’t be as a Power Platform guy anyway. And I don’t get a raise or bonus for doing it. But it was kind of fun and interesting to do. It’s been so long since I’ve had to take a test that it felt kind of weird to do it.

On the broader topic of continuing education, I’ve got a lot of stuff going on. This post is getting pretty long, so I’m not going to get into any of that here. Maybe I’ll write up another post over the weekend.

(UPDATE: Since I first published this, I’ve figured out that I can share a certified link to the certification through a site called Credly. So here’s the official link. So now you know I’m not lying about all this.)

getting authentication tokens from MSAL via PowerShell

I have a little PowerShell script that I can use to get tokens from MSAL, for an API project I maintain, and I could have sworn that I’d blogged about it at some point. But I can’t find a post mentioning it. So I guess it’s one of those things I meant to blog about, but never got around to it.

I just rewrote it for a new API project, so I thought I’d blog about that. And since I never actually blogged about the first version, I might as well include that too.

So the first API is an older .NET Framework project. In the Visual Studio solution, I have both the API and a console program that can be used to run some simple tests against it. The console program, of course, uses MSAL.NET to authenticate. (I blogged about that in 2021.) I also like to do little ad-hoc tests of the API with Fiddler, using the Composer tab. But I need to get a bearer token to do that. There are a bunch of ways to do that, but I wanted a simple PowerShell script that I could run at the command line and that would automatically save the token to the clipboard, so I could paste it into Fiddler. I also wanted the PowerShell script to read the client ID and secret (and other parameters) from the same config file that was used for the console program. The script shown below does that, reading parameters from the console program’s app.config file, and pulling the actual client ID and secret from environment variables. (All of this is, of course, to avoid storing secrets in any text files that might get accidentally checked in to source control…)

# get-auth-hdr-0.ps1
# https://gist.github.com/andyhuey/68bade6eceaff64454eaeabae2351552
# Get the auth hdr and send it to the clipboard.
# ajh 2022-08-29: rewrite to use MSAL.PS.
# ajh 2022-11-23: read secret from env vars.

#Requires -Version 5.1
#Requires -Modules @{ ModuleName="MSAL.PS"; ModuleVersion="4.0" }

# force TLS 1.2
$TLS12Protocol = [System.Net.SecurityProtocolType] 'Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol

echo $null | clip	# clear the clipboard.

# read the settings file.
$configFilePath = ".\App.config"
[xml]$configXML = Get-Content $configFilePath
$configXML.configuration.appSettings.add | foreach {
	$add = $_
	switch($add.key) {
		"ida:Authority" 		{$authority = $add.value; break}
		"xyz:ServiceResourceId"	{$svcResourceId = $add.value; break}
		"env:ClientId"			{$client_id_var = $add.value; break}
		"env:ClientSecret" 		{$client_secret_var = $add.value; break}
	}
}
if (!$client_id_var -or !$client_secret_var -or !$authority -or !$svcResourceId) {
	Write-Error "One or more settings are missing from $configFilePath."
	return
}

# and the env vars.
$client_id = [Environment]::GetEnvironmentVariable($client_id_var, 'Machine')
$client_secret = [Environment]::GetEnvironmentVariable($client_secret_var, 'Machine')
if (!$client_id -or !$client_secret) {
	Write-Error "One or more env vars are missing."
	return
}

$scope = $svcResourceId + "/.default"
$secSecret = ConvertTo-SecureString $client_secret -AsPlainText -Force

$msalToken = Get-MsalToken -ClientId $client_id -ClientSecret $secSecret -Scope $scope -Authority $authority
$authHdr = $msalToken.CreateAuthorizationHeader()
$fullAuthHdr = "Authorization: $($authHdr)"
$fullAuthHdr | clip
"auth header has been copied to the clipboard."

For my new project, I needed to create a new version of this script, since the new project is in .NET Core, using an appsettings.json file rather than the old XML format app.config file. I’m also now using the Secret Manager to store the client ID and secret.

# get-auth-hdr-1.ps1
# https://gist.github.com/andyhuey/de85972ec0f6268034e5ce46b0278a07
# Get the auth hdr and send it to the clipboard.
# ajh 2023-04-06: new. 

#Requires -Version 7
#Requires -Modules @{ ModuleName="MSAL.PS"; ModuleVersion="4.0" }

# force TLS 1.2
$TLS12Protocol = [System.Net.SecurityProtocolType] 'Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol

echo $null | clip	# clear the clipboard.

$secrets = dotnet user-secrets list --json | ConvertFrom-Json
$clientId = $secrets.'AuthConfig:ClientId'
$clientSecret = $secrets.'AuthConfig:ClientSecret'
$secSecret = ConvertTo-SecureString $clientSecret -AsPlainText -Force

$appSettings = Get-Content appsettings.json | ConvertFrom-Json
$scope = $appSettings.AuthConfig.ResourceId
$authority = $appSettings.AuthConfig.Instance -f $appSettings.AuthConfig.TenantId

$msalToken = Get-MsalToken -ClientId $clientId -ClientSecret $secSecret -Scope $scope -Authority $authority
$authHdr = $msalToken.CreateAuthorizationHeader()
$fullAuthHdr = "Authorization: $($authHdr)"
$fullAuthHdr | clip
"auth header has been copied to the clipboard."

So this one is calling “dotnet user-secrets list” to get the secrets. And it’s using “ConvertFrom-Json” for both that and the appsecrets.json file.

Both scripts are using MSAL.PS for the MSAL call.

One thing that might not be obvious in the second script is that the “Instance” value is formatted like this: “”https://login.microsoftonline.com/{0}” so we’re using the “-f” string format function to pop the tenant ID into that {0} placeholder. (I took that functionality from an online sample I found somewhere, but I may change that around, since I think it just confuses things.) Also, in the first example, I added “/.default” to the $scope variable in the script, while the new version already has that in the config file.

I’m not sure if any of this will ever be useful to anyone but me, but it seems like something that might help someone else out there on the internet somewhere, at some point.

more on Microsoft certification

Since this post from earlier this month, I asked my boss about whether or not the company would pay for a cert exam for me, and I got back not just a “yes” but an exam voucher code, and a code for a free MeasureUp practice exam! Which is great, but now I guess I have to take the exam.

I just noticed this post in my “on this day” sidebar, with a nice photo of the three giant books I bought to study for the three cert exams I was going to take for ASP.NET certification, back in 2010. I only ever took the first exam, then I got too busy with work to study for and take the other two.

I feel like I’m in a similar situation now, except that I’m not even going to find time to study for and take the first exam. I used the MeasureUp code, and got access to the practice test for PL-900. It seems to be identical to the MeasureUp test that I previously got for free through ESI. I took it again, and got less than 60% on it, which is definitely not a passing grade. If I want to pass, I think I need to study up on some areas I didn’t do well in, which are basically the areas that I’m not interested in and that aren’t relevant to my job right now. But if I want to pass the test, I guess I need to learn them. Sigh.

Microsoft certification

I’ve been trying to learn a lot of new stuff lately, including Power Platform, which I’ve mentioned a few times recently. And I’ve been thinking about taking the certification exam for that, PL-900. My company has access to something called ESI from Microsoft, which used to allow us to take MS exams for free. Well, I guess I waited too long on the PL-900 exam, since they changed ESI so it now only provides a 50% discount. And the ESI site used to allow us to take MeasureUp practice exams, but now it just shows us simpler Microsoft-provided practice tests. I’ve seen some talk about both of these changes on reddit, here and here.

Well, at 50% off, the test is only $50, which I can, of course, afford. Thirty days of access to the MeasureUp practice exam is $99, though they’ve got a 30% off sale going on right now. That might be worth it, but maybe not. I haven’t tried the new Microsoft practice test yet, though it seems to be less full-featured than the MeasureUp one.

Anyway, my last Microsoft cert exam was in 2010. It’s so hard to keep up with all this stuff. I’ve been busy enough this week that I haven’t gotten back to any of my “spare time” learning work. If I really want to take (and pass) that PL-900 exam, I need to brush up on a few things first.

Power Platform and Pathfinder

My head is spinning a lot lately, from all the new stuff I’m trying to get up to speed on. I did a full-day App in a Day workshop last Friday, to refresh my memory on how to build canvas apps and model-driven apps for Microsoft Power Platform. I’ve also been working through a lot of the stuff at Microsoft’s Low-Code February site, including the Cloud Skills Challenge, which I completed.

Meanwhile, I also need to try to learn about Dynamics 365 F&O (which isn’t called F&O anymore, but I’m not sure what else to call it). And I started trying to learn Angular a while back, but I keep putting that to the side. My last post about “being overwhelmed by the amount of random stuff I need to learn” was this one from October. Things still haven’t settled down.

And, on the personal side of things, I’m continuing to try to figure out Pathfinder. At this point, I’ve managed to create a character (a half-elf wizard), but really don’t have him fully fleshed out yet. I’ve been reading both the Core Rulebook and the Strategy Guide. And, for some reason, I decided to pick up a hard copy of the Core Rulebook. It’s the “pocket edition,” and the print is too small for me to read comfortably, so it’s mostly useless for me, but I like picking it up and feeling how heavy it is. (Is that weird?) We still haven’t played yet, but we’ve had one organizing session over Zoom (mentioned here), and a second brief session over Discord. I guess we’re going to use a combination of Discord and Roll2o to run the game.

Ten years at SHI

I happened to notice my five year work anniversary post earlier this week, and thought I should write a ten year anniversary post. I hit my ten year anniversary about a week ago. I guess it’s kind of a big deal, since this is only the second job I’ve had that’s lasted this long. The previous one was NMS, where I worked for around 13 years (1996-2009). I probably would have hit 15 years there, if the company hadn’t got out of business.

A lot has changed at SHI since that five-year mark. A lot of those changes happened in 2022. I switched to a new boss, then back to the old boss. There have been a lot of management changes within IT in 2022. And I got promoted to “IT Solutions Manager,” whatever that means. I now have three direct reports, all CRM developers (which is kind of awkward, since I don’t really know our CRM system).

I’m doing less AX 2012 development, and am gradually moving into more Dynamics 365 development. We’re just in the planning stages of moving off of on-prem AX 2012 to Dynamics 365 F&O. And, since the CRM devs have been moved into our group and now report to me, I’m learning about our Dynamics 365 CRM environment. It’s all going pretty slowly, but we’re a big company and there’s a lot going on. (And yes, I know that F&O apparently isn’t called F&O anymore and CRM isn’t called CRM anymore. I can’t keep up with Microsoft’s crazy product naming shenanigans…)

I think there’s a good chance I’ll still be with SHI in five years. (Though I worry that saying that out loud will jinx it…) There have been a lot of layoffs at tech companies recently, but I don’t think SHI is planning any. And it seems like there’s a lot of opportunity there to do interesting work.

I’m realizing now that I’ll be 60 years old in five years, and 65 in ten years. I don’t know if there’s any point in thinking that far ahead, but it seems to me like there’s a real chance I could finish out my working years at SHI.

There’s a lot more I could say about my job right now, but there wouldn’t be much of a point to it. I’m relatively content where I am. There’s a lot of uncertainty, but there’s uncertainty everywhere. I think I have some good coworkers, and I think I’m in a pretty good situation.

New Year’s Day 2023

It’s 8 AM on New Year’s Day, and here I am again writing my traditional New Year’s Day post. I have a bit of a headache today, not because I was up late partying, but because I had trouble sleeping. I went to bed at 9:30 last night, and slept reasonably well until around 11, when nasal congestion and random noise from outside woke me up and pretty much ruined my sleep until around 4 AM, when everything quieted down and my nose cleared up, and I managed to get a couple of hours of sleep. I got out of bed at 7. I guess I have enough coffee in me now that I can get through the day, but I think I’ll need at least one nap today, and I’ll probably need to go to bed early again.

I’ll start this post out with links to some previous posts:

  • Last year, I blogged on Jan 2.
  • And here’s 2021, 2020, and 2019.
  • And probably my earliest New Year’s Day overview post, from 2008.

And I’ll break this post down into sections, since it might get a bit lengthy.

Health, Weight, and Sleep

I started seeing a new doctor this year, and she wasn’t interested in seeing me more than once this year, so I only had a single doctor’s visit in 2022, in May. My blood work was fine, and I guess my general health is fine.

I got two COVID booster shots this year, in April and September. The second one was the bivalent booster. As far as I know, I still haven’t gotten COVID. I might have gotten a mild case once or twice; I’ve certainly been sick a few times. But never bad enough to see a doctor. (And I usually test myself for COVID if I’m sick, and I’ve never had a positive test.)

I do feel like I got sick more often than I’d like last year. I’ve noticed that doing pretty much anything that involves being out in a crowd for a nontrivial amount of time results in me getting sick the next day. I’ve always been like that, to some extent, but I think it’s getting worse.

My sleep has been good and bad this past year. In the last couple of weeks, it’s been more bad than good. but for a few weeks prior to that, I’d been sleeping quite well. So I’m not sure what’s going on there. I think that a lot of it is sinus problems.

My weight has gone up a bit this year. I started 2022 at 140 pounds, and I’m now at 150. I’d intended on drawing the line at 140, but I’ve just crept up to 150, and I haven’t really cared enough to commit to getting it back down. I’m not sure if I need to, really, if I can actually draw the line at 150. I think that’s a reasonably healthy weight for me. My problem over the last year is that I’ve been eating a lot of cookies, to be honest.

I’ve done well with exercise this year, I think. I’ve been pretty consistent about getting a lot of walking done. In fact, it’s nice enough out that I should probably take a break from this blog post and go out for a walk right now.

Work

…and now I’m back from my walk and it’s a little after 9 AM. So my next section is going to be about work. I’m still working for SHI, and I’ll hit my ten-year mark this month. My longest time at one job was NMS, where I worked for around 13 years. So SHI is in second place, and may surpass NMS, if I manage to stick around for a few more years.

After being in pretty much the same position, with the same manager, for most of my time at SHI, there were a lot of changes in 2022. In April, there was a bit of a shake-up, and my group got moved under a different manager, in a different group. Then, in July, we had the data breach. And in August, there was another management shake-up, and I got moved back under my old manager. And in November, I was promoted to “IT Solutions Manager” and am now responsible for managing three programmers. Additionally, these programmers work on our CRM system, so I’m (gradually) moving from working primarily on AX to working on CRM.

And that’s a simplified timeline. There’s a lot more going on than what I described there. I guess it’s mostly good, and we’re on a good path for growth in 2023? I’m not really high-level enough to have a good picture of the company’s overall health, and whether or not we’re on the right path. I guess I’ll stick with “cautious optimism.” I’ve updated my resume, but I’m hopeful that I won’t need it in 2023.

In terms of professional development, it’s good that I’ve been promoted into management, I guess. I’m still basically a hands-on programmer, and my three reports are doing their own thing, for the most part. I may take more of an active hand in 2023, but that’ll depend on how things shake out.

Looking at the books I’ve read and courses I’ve taken in 2022, I put a fair bit of effort into learning scrum earlier in 2022. There was a big push for scrum that went along with the April management changes. That kind of fizzled out after the data breach and the August management changes, but we’re still (kinda) doing scrum. I also put some effort into working on programming fundamentals, reading a few books related to “Clean Code” and refactoring. And, for specific technologies, I’ve been trying to learn a bunch of random stuff that’s all directly related to projects I’m working on. I could get into all that, but then this post would get way too long.

The New Normal

…for lack of a better title. COVID is still a thing, regardless of whether or not people want it to be. SHI has us working in the office two days a week now. For me, that’s Tuesday and Thursday. It’s not too bad, I guess. I wear a mask when I’m not at my desk. There aren’t too many other people who still do, but there are a few.

They might let us keep to the two day schedule through 2023, but they also might try to get us to come back full-time, or maybe four days a week. I’m not sure. I’m really hoping they stick with the two day per week plan. I’m not ready to go back to the office full-time.

I don’t go out nearly as often as I used to. My only trip to NYC this year was in March, when I took the train to Albany for a funeral. (I switched from NJ Transit to Amtrak in NYC, so it was just a brief visit.) And that trip was really my only trip out of NJ. I almost had my E-ZPass canceled this year, because I haven’t used it since 2019. I got them to keep it active for another year, but I should probably give it up. Similarly, I should probably give up on my memberships to the Met and MoMA. I haven’t used either this year.

I had bought a badge for NYCC in October, but I decided to skip it and got a refund. I’m pretty sure that was a good idea, and that I would have gotten horribly sick if I’d gone. I may be done with comic conventions entirely now. I’m really not sure.

Books, Movies, TV, Music, Etc.

So this is the fun part of the post. (Maybe.) I’ll start with a link to my Goodreads Year In Books for 2022. I read 76 books this year. A lot of them weren’t really books, per se. I started the year with a bunch of Big Finish Doctor Who audio dramas, for instance. Looking at the list, I think I read around 20 actual novels in 2022.

I gave up on trying to read any classics in 2022. Instead, I put some effort into putting a dent in my backlog of random Kindle books, reading stuff that I got from old Humble bundles and stuff like that. There was some good stuff in there, but also some stuff that was OK but forgettable. I also got back into a couple of my favorite book series, The Dresden Files and The Laundry Files. I’d last read a Dresden book in 2015, and a Laundry book in 2017. I didn’t read a lot of comics in 2022. Probably my favorites were the two Hilda books I read.

For movies: I still haven’t been back to a theater, since 2019. So I only watched movies at home. From my Letterboxd stats page, I can see that I watched 84 films in 2022. That’s less than 2021, when I watched more than 100 films. My highest-rated films from 2022 were My Father’s Dragon, Turning Red, and Doctor Strange in the Multiverse of Madness. My highest-rated re-watches were Howl’s Moving Castle and Who Framed Roger Rabbit, both of which I bought on Blu-ray in 2022.

For music: I mostly listened to music via Apple Music this year, so (in theory) my Apple Music Replay ’22 page should be pretty accurate. In practice, it’s a little weird. My top track for the year is the first track on Max Richter’s Sleep, which is probably because I put it on sometimes when I’m taking a nap on my sofa. My second most-listened track is Heavy Heart, by Bartees Strange, which makes sense, I guess. I do like that song.

Beyond that, I’ve listened to a lot of Bombay Bicycle Club, Bibio, and a few others. If I was going to pick my favorite album from 2022, it would probably be Bibio’s BIB10. Replay doesn’t tell you how many albums you’ve added to your library during the year, but I keep a list of those in Evernote, and I see I added over 50 albums in 2022. So I’m definitely listening to a lot of new stuff. (And old stuff too.) I guess I’m getting my money’s worth out of Apple Music.

For TV: I don’t keep track of the stuff I watch on TV the way I do with books and movies. I’ve definitely watched a lot of TV in 2022, but I can’t think of anything in particular that stands out. I’m still subscribing to Netflix, Disney+, and Paramount+. I switched to the Disney Bundle in 2022, so I get Hulu and ESPN+ too now. I’m not particularly proud of the amount of TV I watch these days, but there are times when I’m just too tired to do much else.

Summary

I feel like there’s more I wanted to write about here, but it’s almost 11 AM now, and I’m running out of steam. I should wrap this up, and maybe go out for another walk. I’m not making any resolutions for 2023. I’m planning on just playing it by ear. If I can manage to lose a few pounds, that’d be nice. If I can move forward on some professional stuff, that’d be good too.

a little PowerShell

It’s been a while since I’ve posted any PowerShell code. I had to write a quick script today to run some SQL, save the output to CSV, then ZIP the CSV file. And I had to loop through and the run SQL multiple times, one for each month from January 2021 until today.

That forced me to look up some stuff that I didn’t know how to do in PowerShell, off the top of my head. (In fact, most of it was stuff I didn’t know off the top of my head. I don’t use PowerShell enough to remember anything…) So here’s an edited version of the script, simplified somewhat. It might come in handy some time, if I ever need to do this again.

# CustInvAll-export.ps1

#Requires -Version 7
#Requires -Modules SqlServer

$dateFmt = 'yyyy-MM-dd'
$sqlServer = "MyServer"
$dbName = "myDB"

$curDate = [DateTime]::Today
$startDate = [DateTime]'01/01/2021'
while ($startDate -lt $curDate) {
    $endDate = $startDate.AddMonths(1)
    $startDateFmt = $startDate.ToString($dateFmt) 
    $endDateFmt = $endDate.ToString($dateFmt)
    
    $exportSQL = @"
    SELECT *
    FROM MyTable
    where [INVOICEDATE] >= '$startDateFmt' and [INVOICEDATE] < '$endDateFmt'
"@
    $exportFile = "CustInvAll-$startDateFmt.csv"
    $exportFileZip = "CustInvAll-$startDateFmt-csv.zip"

    echo "Exporting from $startDateFmt to $EndDateFmt to file $exportFile"

    # Invoke-Sqlcmd -ServerInstance $sqlServer -Database $dbName -Query $exportSQL `
    # | Export-CSV -Path $exportFile -NoTypeInformation  -UseQuotes AsNeeded

    # Compress-Archive -LiteralPath $exportFile -DestinationPath $exportFileZip

    $startDate = $endDate
} 

It can also be found in a Gist.

Programming Potpurri

I’ve been meaning to write a blog post or three about some of the programming-related stuff that I’ve been doing at work recently. But I keep putting it off. I’ve got some energy today, and a little spare time, so I’m going to try to write up some random notes.

Razor Pages

A while back, we had an old SharePoint 2013 page stop working. The page uses a control that I wrote in C#. The control really has nothing to do with SharePoint; it’s basically an old-fashioned ASP.NET web form that makes some web service calls, populates some controls, gathers user input, then makes another web service call, then redirects the user to another page. The only reason it’s in SharePoint is… well, that’s complicated. Let’s not get into that!

Anyway, fixing the page would take about five minutes. I’m pretty sure all I needed to do was increase a timeout, and increase the max receive size on a certain web service call. But… my SharePoint development VM got nuked in our security incident back in July. So the actual time to fix the error would be more like several days, since, at this point, I have no clue how to build a SharePoint 2013 development machine from scratch. I’m pretty sure I could do it, but it would take a lot of time and effort.

So I decided to just rebuild the page as a single-page ASP.NET Razor Page project, which seemed like it would be a fun thing to do, and might be a good model for moving some other stuff out of SharePoint. At the time, I wasn’t too busy. Of course, that changed, and now I kind of regret diving into this. But I did, and managed to learn enough about Razor to get the page done and into production.

I’d known a bit about Razor already, and had messed around with it on and off over the last few years. But most of my recent ASP.NET work has been web services, so there’s no need for Razor there. First, I was surprised to realize that Razor has been around since 2010. Scott Guthrie’s blog post announcing it is from July 3, 2010. I’ve still been thinking about it as “new,” but I guess it’s not. Heck, I guess it could even be considered “legacy” by some folks. (I guess maybe Blazor is what the cool kids are using now?)

Since it’s been around awhile, there are some reasonably good resources out there for learning it. But, also since it’s been around awhile, a lot of it is scattershot, or out of date, or not really relevant to what I was doing. The best resource I found is the Learn Razor Pages site. I almost bought the related book, ASP.NET Core Razor Pages in Action, but before I got around to it, I was pretty much done with the project, and had to move on to other stuff.

Dynamics 365

So, with the changes that are going on at work, it looks like I’ll have to be doing a lot more work with Dynamics 365. D365 is a pretty big topic. It looks like I’ll probably be mostly concerned with Dynamics 365 Sales (formerly known as CRM). I took a three-day class on Power Platform back in 2020, which is kind of the underlying technology for D365. Power Apps and Dataverse in particular are important. (The terminology on this stuff is really annoying. When I took that class two years ago, Dataverse was called “Common Data Service” and some of the other related terminology was different. It’s hard to keep up…)

I now have Pluralsight and LinkedIn Learning access via work, so I watched some videos on those sites, and on Microsoft’s Learn site, to refresh my memory from previous efforts to learn this stuff, and pick up on the new stuff. I guess I’m now almost at the point where I could be useful…

VSTO and EWS

Related to all that, I’ve been assigned to work on an Outlook plugin that ties into D365, and a console app that does some back-end processing related to the plug-in. So now I also need to learn VSTO, which is how the add-in was built, and EWS, which is used in the console app.

VSTO is a bit out of date, but not yet deprecated. If I was going to do a major rewrite on the plug-in, I’d probably switch to Office Add-Ins, which is a bit more modern, I guess.

And EWS is also out of date but not yet deprecated. If I wanted, I could probably move from that to the Graph API.

The main thing I need to do with these projects is to get them to work with Exchange Online. (We’re in the middle of migrating from on-prem right now.) I think I won’t actually have to change the plug-in at all, since it’s working with the Outlook object model, and I don’t think that cares if the email came from Exchange Online or on-prem. There might be a “gotcha” or two in there, though, so I need to at least test it.

For the console app, EWS still works with Exchange Online, but I know I’ll have to change a few things there, including switching over to OAuth for authentication.

And both apps seem to need some cleanup in terms of logging and error-checking. I know that if I make changes to these apps, then people are going to start coming to me with support questions, so I’ll need to make sure I have enough logging to provide support.

There’s actually been a lot of overhead involved in getting up and running on this project. These programs were originally under a different dev group, part of which has gotten moved into my group, so they’re using some conventions and utilities and stuff that I don’t know, and need to learn (and in some cases, gain access to). And I don’t have Outlook on my dev VM, since that’s not normally allowed (for security reasons). And I can’t get to the Exchange Online version of EWS, since that’s blocked (for security reasons). And I need to set up a new app registration, so I can access EWS with OAuth, and that needs to be approved by a global admin. And so on.

Was there a point to this?

If there’s a point to all this, I guess it’s just that I need to keep learning new things and being flexible. I saw a funny comic strip recently about an old man whose doctor tells him that he can help keep his memory sharp by learning new skills. And the old man says that his memory isn’t good enough for him to learn new skills. And of course I can’t remember where I saw that strip now, so I can’t link to it here. It was probably on GoComics, which I recently re-subscribed to, after canceling my subscription almost a decade ago. I’ve decided that reading the comic strips every morning is healthier than browsing Facebook and Twitter, so that’s why I re-subscribed. (I may also sign up for Comics Kingdom too, but that’s a subject for a different blog post.) Anyway, since I can’t find the strip I was looking for, here’s a different one, along similar lines.

A Busy Day

As previously mentioned, I got my COVID booster shot today. I also picked up my new iPhone 14 from CVS, though I had to make a separate trip for that, since it hadn’t arrived yet when I went for the booster. I guess the phone had gone back to the depot on Friday, then sat there all weekend, then got put on a truck this morning for delivery to CVS. Sigh. Well, I’ve got it now, so all is well.

This booster is my fifth shot, overall. The last shot was in April. I’m hoping I don’t get any side-effects from this one, since I’ve got a pretty busy week at work, and I don’t want to have to take a sick day. (But I will if I need to.)

The iPhone setup was relatively easy. I think the only major thing I still need to do is the MS Authenticator setup, which I’ve previously complained about. I’ll try to do that in the office tomorrow, where I’ll have access to my work desktop PC and my office phone, just in case any of my accounts still have the office phone number as a backup. I’m anticipating that’ll take about an hour.

Meanwhile, I had also ordered a new router this weekend, and that showed up today. I ordered this one, from Amazon. It was $80. I didn’t do a ton of research, bit it seems to be a successor to one that had been recommended by Wirecutter. I also found a good CNET review of it. I don’t have much to say about it yet, since it’s still in the box, and will likely remain there until this weekend.

I bought my current router in 2017, so it was time for a new one. The old one still works, but it doesn’t support some of the more modern features and standards. Honestly, I haven’t kept up with all that stuff, so I couldn’t even tell you which ones are which, at this point, but I know I was time for a new router. So I’ll try to get that set up over the weekend, probably, and I’ll have more to say about it then.

On another subject, there are a lot of changes going on at my job right now, and it looks like one of them may snowball into a pretty big change for me. (Or not. Hard to tell.) Either way, I think I need to learn a lot more about Dynamics 365 and Power Platform and stuff like that. I’ve made some efforts at learning that stuff in the past, but I never wind up actually working on anything real with it, so the knowledge doesn’t stick. And of course everything changes, so the stuff I picked up two or three years ago is different now anyway.

A lot of the changes we made in April are getting, well, changed. I wouldn’t say “rolled back,” but I am back under the boss I had before the big changes in April. But she’s under a different boss. And we seem to be backing off on our enthusiasm for scrum a bit. And, as mentioned above, I guess I’m going to need to learn more about the Dynamics 365 side of things. Which is good, I guess, but right now, my head is spinning.