Managing .Net Core versions the easy way

As .Net Core toolchain is rapidly evolving, I found myself spending a bit of time ensuring that I only keep latest versions of .Net Runtimes / SDKs / Bundles by uninstalling older version manually through App & Features Wizard.  There is now an easier way to do this.

Behold DotNet-Core-Uninstall project.  The .Net Foundation community is building this gem to help us with this task.  Currently, there is no Chocolatey package yet, so go ahead and install the latest msi under releases.

List all of the installed SDKs / Runtimes / Bundles:

dotnet-core-uninstall list

Do a dry-run to understand which SDKs will be removed:

dotnet-core-uninstall dry-run --all-lower-patches --sdk

Delete all but the latest patches of the SDKs:

dotnet-core-uninstall remove --all-lower-patches --sdk

Any SDKs that are currently in use by VS2017/VS2019 are not uninstalled and may require manual action.  So we can uninstall a specific version like this:

dotnet-core-uninstall remove 2.1.701 --sdk

This is now easy to maintain the installations going forward.  NOTE, any SDKs/runtimes installed through VS tooling will be managed and upgraded by the VS Installer so this only applies to older or one off installations.  Lastly, this tool also works on Mac OS as well, just download the tar.gz version.

Retrieve VM FQDN via Azure CLI

Surprisingly trying to get an rdp file or enough information to start an rdp session via Azure CLI is anything but trivial. This is what i am currently doing on my machine (zsch):

az vm show -n <name>  -g <group>  -o jsonc -d | grep fqdns

Then, i grab the value and copy to the clipboard. Seems too much work. I need to find an easier way.

Quickly Exporting of Certificates via PowerShell

As I was doing some work with Sitecore Automation Framework, I needed to quickly export certificates from my local store.  Here is the quickest way that I could come up with.

ls | ?{ $_.FriendlyName -match "_SAF$" } | %{ Export-PfxCertificate -Cert $_ -FilePath "C:\<projroot>\infra\configuration\Local\$($_.FriendlyName).pfx" -Password (ConvertTo-SecureString -String "1234" -Force -AsPlainText) }

Maybe there is a nicer way to do that but that’s what comes to mind.

Sitecore 9.0.X Dependency Injection does not use latest Microsoft DI

With all of the excitement with Sitecore 9.X, sometimes it is very tempting to fire up a new project, get the latest NuGet packages and off you go, but there are a few subtle things to remember that Sitecore is embracing rather more niche dependencies and having embracing Microsoft.Extensions.DependencyInjection library from Microsoft is also one of them.

With Sitecore 9.0.X (pre 9.1), Sitecore Dependency Injection mechanism is dependent on on Microsoft.Extensions.DependencyInjection version 1.X.  If you are happen to add NuGet Package with version >2.X then you will get the following awesome message when deploying to the instance:

Method not found: ‘System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)’…

Please beware, to keep the version of dependencies strictly to what is provided by the version of the platform. Review carefully.

Setting up Docker on an Azure VM for Development

One of my goals for 2018 is to ramp up with using containerization as a go to approach to development.  Thus, having a solid development environment that can run Docker is certainly a must.  Just like with many enterprises, Windows 7 or Windows 8.X dominates still and thus you may end up stuck, due to Docker on Windows requirements.

Azure comes to the rescue here with Nested Virtualization feature for Dv3 and Ev3 VMs.

  1. Install a Windows 10 Pro image with Standard_D4_v3 size and make sure its location is either East or West 2.
  2. Install Hyper-V on Windows 10 Pro
    Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All
  3. Install Docker for Windows as per standard instructions.

That was easy.  Don’t forget to turn on auto shutdown for your developer VM to conserve credits.  Cheers!

Sitecore 9 is here

I have been recently delving into the Sitecore CMS due to client’s needs.  It has a pretty close community due to the fact that Sitecore folks wants people to pay money for everything but the platform is growing on me.  Thus, I want to make a few folks aware that Sitecore 9 has been announced, presumably at Symposium 2017.  It has a ton of new features but the most exciting that all of its components are supporting PAAS deployments.  It’s time to take a lap around it in Azure.

Windows Auth with local IIS developer workstation

I was just troubleshooting an issue with legacy code base on my client workstation.  It is IIS 7.5 (guess what OS i am running) with Asp.Net  4.X and v2.0/v3.5 ISAPI registered.

The Asp.Net legacy application is built using windows authentication for security purposes.  When I configured the local code base to publish to local IIS website with a custom name, the website kept on prompting me an error.  For the life of me, I could not figure out the issue.  Setting Application Pool back to “Network Service” from ApplicationPoolIdentity did not fix the issue.

After breaking my head for hours, I finally remembered this little Gem from the past with the help of Google of course.  Basically, for NTLM and Kerberos if the target IIS host is in the domain, it is very strict who is allowed to authenticate via SSPI (fancy acronym for security negotiating).  I will need to update my developer on-boarding script to make sure I either disable loop-back checking or white-list the local custom dev URLs.  Security to insanity!