Jan David Narkiewicz (Developer)
Wednesday, April 10, 2024
PowerShell: Folder Diff
Wednesday, April 3, 2024
Visual Studio Code: Error Generation Bicep Template from Existing Azure Resource
The latest version of Microsoft's Bicep Extension (v0.26.54) for Visual Studio Code has a new behavior that causes an error message to be generated under certain circumstances. The Bicep Extension was covered in a blog post eighteen months ago (November 26, 2022: Azure: Generate a Bicep Template from an Existing Azure Resource using Visual Studio Code) and the manifesting of the following error message is a newish behavior in the extension:
Tuesday, April 2, 2024
Visual Studio Code: Azure Extension Pack error "Expected value to be neither null nor undefined"
This post presents a solution to the following error displayed in Visual Studio Code when using the Azure Tools Extension Pack:
Internal error: Expected value to be neither null nor undefined: resourceGroup for grouping item
The Azure Tools Extension Pack (Azure Tools) is critical to Azure developers who use Visual Studio Code (see the A below):
When signed in to a subscription, the Azure Tools Extension displays Azure resources by default, grouped by resource group. For some subscriptions (not all) the following error is displayed by Visual Studio Code when group by is set to "Group by Resource Group":
The fix to this issue is to click on the group by icon:
This displays the following context menu:
Sunday, March 24, 2024
Azure DevOps: Requiring Pull Requests to be Associated with a Work Item
Whether following Git Flow, GitHub Flow, GitLab Flow or Trunk-based Development certain policies are standard to source code best practices. For example. each Pull Request (PR) must be associated with a single task/story/epic (a linked work item). This post discusses Azure DevOps support for this feature.
For a given ADO Git repo, branch policies (such a requiring a PR to be linked to a work item) are set per-branch. There is no way to assign such policies to multiple branches. In order to set a branch's policies, navigate to a Repo's branches tab:
For a branch whose policy is to be set, click on the three dots to show the context menu shown below:
Git Branch Strategies
Git Branch Strategy: Git Flow
- Main/Master
- Develop
- Feature
- Release
- Hotfix
Git Branch Strategy: GitHub Flow
- Main/Master
- Feature
Git Branch Strategy: GitLab Flow
- Main/Master
- Feature
- Pre-Production
- Production
Git Branch Strategy: Trunk-based Development
- Main/Master
- Trunk
- Feature
Friday, March 22, 2024
Azure/PowerShell: Geolocating Storage Account White Listed IP Addresses
On a project, we had provided access to to an Azure Storage account by adding permitted IP addresses to the firewall (white listed IPs). These settings can be found via https://portal.azure.com/ by navigating to the storage account and selecting Network under "Security + networking":
I was tasked with writing a script to list all the white listed IP addresses and display there geographic location. The http://ip-api.com returns (for free) the geo data associated with an IP address. This service is free for no-commercial use:
The PowerShell script to return this information takes two required parameters:
- $resourceGroupName: resource group name associated with storage account
- $storageAccountName: storage account name whose white listed IPs will be returned
The script in its entirety is as follows:
IP Ranges versus Individual IP Addresses
Wednesday, February 7, 2024
Azure: Virtual Machines that support WSL
Azure Nested Virtualization Capable VMs
In order to run WSL and potentially Docker on an Azure Virtual Machine (VM) a VM's SKU Family must be hyper-threaded and be capable of running nested virtualization. The following link from Microsoft Learning, Azure compute unit (ACU), demarcates in a table all nested virtualization capable VMs by three asterisks:
Azure WSL Capable VM Types
The Azure VM that are capable of supported WSL (a.k.a. capable of running nested virtualization) are as follow from Microsoft's article, Azure compute unit (ACU), provided that the vCPU: Core column contains three asterisks:
Azure Subscription may not include WSL Capable VM Types
Be aware the not ever Microsoft subscription supports such Virtual Machines. For example the subscription that comes in a Visual Studio Subscription (the $150 free monthly Azure credit) might contain no virtual machines types that are nested virtualization capable.Saturday, February 3, 2024
Docker: Fails on Windows Immediately After Install
Recently I installed Docker on a Windows 11 Pro laptop. Immediately after install I attempted to run a Docker image containing PowerShell. This image was run by invoking the following command from a PowerShell console:
As engineers we all have our Home Simpson, "Duh" moments. When I actually looked at Docker Desktop, I saw the following:
I had failed to Accept the terms of service screen so the Docker Engine was not started. The lesson learned: After installing Docker Desktop on on Windows 10 Pro or Windows 11 Pro, run Docker Desktop and click on the Accept button.
I am very explicit about using Windows 11 Pro or previously Windows 10 Pro. The reason for this is that Windows 10 and Windows 11 can run Linux containers only with Docker installed. In order to run Windows containers, Windows 10 Pro or Windows 11 Pro is required.
In a previous blog, I noted a change I'd made (indirectly) to Docker's installation instructions for Docker Desktop on Windows, Install Docker Desktop on Windows. I created a PR in the documentation noting the importance of Windows Pro and the Docker documentation team added the following warning to their installation guide