Creating a new virtual switch after one has gone haywire

Today I went to tinker around with Network Profiles on Windows 10. I made some changes going from Public to Private and a few changes here and there. After resetting my PC, I realised that some of the VM's (Ubuntu and Windows Server 2016) all using same virtual network adapter that were running could not longer resolve DNS names like www.example.com. Upon diagnosing the situation, I got an error message saying Windows could not automatically detect this network's ...

Connecting to a remote (Azure) Redis Console on Windows via Redis CLI

Installing the Redis CLI You'll need the Chocolatey package manager if you have not yet installed this. choco install redis-64 Connecting to the remote instance Find the password/access key on Azure > Home > Redis Caches > my-redis-db > Access keys> Then whip out our favourite shell redis-cli -h my-redis-db.redis.cache.windows.net -p 6379 -a <access key on Azure> Useful commands # Show all keys keys * # Remove all keys flushall # Monitor gets and sets monitor ...

Useful Powershell commands

Commands and usage Autocompletion (tab and ctrl + space ing) Autocompletion is your friend when it comes to using Powershell. For example, if I want to see a list of running services on my machine I can execute Get-Service but what if I only wanted to see a list subset of that filtered by some property? How would I know what properties I can filter by? ctrl + space to the rescue! Enter Get-Service | Where-Object -Property followed by a ctrl + space this ...

Useful Docker commands

Useful docker commands Cleaning up PS > docker system prune WARNING! This will remove: - all stopped containers - all networks not used by at least one container - all dangling images - all build cache Are you sure you want to continue? [y/N] Stop and remove all containers docker stop $(docker ps -a -q) docker rm $(docker ps -a -q) Commit changes to container and showing history for an image # Create a new image based on changes in ...

View history of start and end execution times in Powershell

Recently I've been trying to scale my Azure SQL database up from a low pricing tier to a higher pricing tier. It seems like the process can take between minutes to hours. I wanted a way of measure how long this would take and while using the Measure-Command commandlet was useful in showing the duration, it didn't show the time it was executed from start to finish. While the duration was helpful, it didn't really reflect the true amount of ...

Copying firewall rules between two Azure SQL servers

Recently I've setup active geo-replication for my database hosted on Azure which basically allows you to asynchronously replicate transactions held on a primary database to a secondary database (usually located in a different geographical region) which is set to read only. The problem was, in a failover/disaster recovery situation, for the secondary to be usable, I would have to manually add all the existing firewall rules on the primary to the secondary which may be updated from time to ...

Comparing Azure Automation with Azure Functions

Two ways to run Powershell Scripts on Azure are on the Azure Automation and Azure Functions platforms. While Microsoft has provided a nice article about the comparisons between Azure Flow, Logic Apps, Functions, and WebJobs, there hasn't been a comparison between Azure Automation and Azure Functions. @johnliu took some notes at MSAUIgnite and posted it on Github which I thought I would share here as well. ...

Exporting all Azure Web App settings for every app on every resource group for both production and staging slots to CSV

I've currently got about 40-50 apps running on Azure's App service offering being deploying using Azure ARM deployment templates. Each app contains AppSettings. There were times when I've noticed that some apps don't get all the AppSettings defined in the ARM template so I wrote a script to print and export the list of appsettings for each of my 40-50 apps for sanity checking. $allWebApps = Get-AzureRmWebApp #$allWebApps = $allWebApps | Where-Object {$_.ResourceGroup -eq 'nameOfresourceGroup'} $resourceGroups = $allWebApps | Select-Object 'ResourceGroup' -Unique $outItems = New-Object System. ...

VSTS find working directory inside a source alias

I wanted to run a custom exe (in my case it was called Warmsole.exe) file as part of my Release Definition using the "Command Line" VSTS task that came out of the box. This task required me to locate the path to the exe. Turns out it isn't a straight forward task as the artefacts are downloaded to a directory prefixed by a Artifact source alias (in my case was called my-build-definition). I have an artefact called ...

Jira configurations

User/Groups and permissions Users and Groups can be configured at the Site level and at the Project level. You can grant permissions defined by members of a project or members of the entire site. This example shows that the permission to Assign issues at the Project level can be mapped to a group named administrators at the Site level. Boards Boards can be a scrum or kanban board. A Scrum board organises issues into Sprints. A Kanban board organises ...

Folder and volume mapping on Windows docker containers

Things I've learnt Mapping folder host to container. In this example I will map a directory c:\foo from my host machine to c:\bar on the target container. Notice that I can read/write files in that directory from both the host and the container. Host Machine cd c:\ mkdir foo docker run -it -v c:\foo:c:\bar microsoft/windowsservercore Windows Container cd c:\bar echo helloworld >> myfile.txt type myfile.txt Mapping a volume host ...

VSTS - Visual Studio Team Services

Setting up a new instance of VSTS Account level settings Region - Australia East Timezone - GMT+10 Users (adding Frank) Agent pools (adding 3 hosted VSTS agents) Security (adding to Frank to Project Collection Administrators) Billing (for adding VSTS agents which does the actual work) Active Directory (created automatically) Project level settings Adding a Azure ARM service endpoint (for Azure relation interactions) Adding a source code repository service endpoint (for Bitbucket) Add a depth of 3 for faster checkout ...

Making custom API requests via Postman's pre-request script feature

Today I came across an API I needed to work with which required me to place custom request headers to make authenticated requests. The content of the headers required some custom logic to generate. In this case it required me to create a string representation of the current UTC date and time in HTTP format (RFC2616 format) e.g 12 Feb 2011 20:59:04 GMT then use that to calculate the hexadecimal HMAC SHA1 hash of that string using ...

Adobe PDF setup

The following is the desired state I would like configured when using Adobe Acrobat PDF reader. Set page display to "Two pages continuous" by default Hide Tools Pane by default Hide menu bar by default (not possible, press F9 as workaround) Hide tool bar by default (not possible, press F8 as workaround) Set page display to "Two pages continuous" by default Edit > Preferences > Page Display > Page Layout : Two-Up Hide Tools Pane Step 1 ...

Replacing New Relic's .NET agent from running on Azure App Services

To have New Relic working for a .NET app hosted on Azure's App Services, I needed New Relic's .NET agent installed in 1 of 3 ways. Manual installation via NuGet Extension installation via the SCM website Extension installation via the Azure Portal Initially I had it installed via the Azure Portal (method 3), which seemed fine but to give us better flexibility in having a "clean" deployment by setting the <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer> flag ...

Adding extra files for MSBuild Deployment

Adding extra files/folders for a MSBuild Deployment that aren't referenced by your project file can be done by adding a target. In this case it is named CustomCollectFiles MyProject.csproj <Target Name="CustomCollectFiles"> <Message Text="Collecting extra files" /> <ItemGroup> <_CustomFiles Include="assets\js\**\*" /> <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)"> <DestinationRelativePath>assets\js\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath> </FilesForPackagingFromProject> ...

Reliance on Google in China

Recently travelled to China. Realised how reliant I was to services provided by Google such as Youtube, Gmail and Calendar and also other apps such as Whatsapp and Facebook Messenger for my day to day tasks quickly became a barrier with the censorship the government has laid down. Photo by Elyssa Zornes / Unsplash The proliferation of WeChat Pay and Alipay in China and the roles of 京东 (jd.com) is playing on the world of commerce. To make use of ...