Apply / Update application settings for Azure App Service using PowerShell

Windows Azure App Service (Now an umbrella term for Azure Web App, Azure Api App, etc.) has a handy capability whereby developers can store key-value string pairs in Azure as part of the configuration information associated with a website.  At runtime, Windows Azure Web Sites automatically retrieves these values for you and makes them available to code running in your website.  Since the key-value pairs are stored behind the scenes in the Windows Azure Web Sites configuration store, the key-value pairs don’t need to be stored in the file content of your web application.  From a security perspective that is a nice side benefit since sensitive information such as Sql connection strings with passwords never show up as cleartext in a config file. However, sometimes, this can be a little too much for the Azure Admins to configure each setting over there. In this blog post, we’ll learn how to apply application settings using PowerShell.  Continue reading “Apply / Update application settings for Azure App Service using PowerShell”

Backup / Restore Data to / from Azure Cosmos Database with Mongo DB API

Azure Cosmos Database (formerly known as Azure DocumentDB) is a PaaS offering from Microsoft Azure. As a document store, it falls into the same category as MongoDB, CouchDB or RethinkDB and other No SQL DBs and just like those, it handles documents in the JSON format.

Azure Cosmos DB automatically takes backups of all your data at regular intervals.  These automated backups are currently taken approximately every four hours and latest 2 backups are stored at all times. If the data is accidentally dropped or corrupted, you can contact Azure support within eight hours.

Now what happens if you figure out after 8 hours that your data is lost or if its corrupted in your development / staging environments or something accidentally went wrong with production while everyone was on holidays. Continue reading “Backup / Restore Data to / from Azure Cosmos Database with Mongo DB API”

Create Azure Storage Shared Access Signature and manage files with PowerShell

In one of the previous posts, we discussed how to create and manage Azure Storage accounts using PowerShell. However, we were using storage account key when trying to upload / delete / download files from azure blob storage. In case, you need to delegate access to a third person, this seems like a too much of access since that person will have access to whole storage account. In this post, we will discuss how to use SAS aka Shared Access Signature to delegate access in controlled way.

Concept of Shared Access Signature

A shared access signature is a way to delegate access to resources in a storage account, without sharing the storage account keys. Continue reading “Create Azure Storage Shared Access Signature and manage files with PowerShell”

Provision Azure Storage Account and automate file upload and deletion using PowerShell

Microsoft Azure Storage is a cloud offering from Microsoft that provides highly scalable, available, durable storage. Its a part of Microsoft Azure offerings. Azure Storage consists of three data services: Blob storage, File storage, and Queue storage. Blob storage supports both standard and premium storage, with premium storage using only SSDs for the fastest performance possible.

Now as is often the case with the cloud services, it comes at a cost. So you should be very careful in using only the space you need and not paying for extra storage consumption that you should not need to. Along with that, you should be able to automate it. In this blog post, we’ll learn how to create an Azure Storage account, uploads some files to it in the blob storage and then delete them all using PowerShell.  Continue reading “Provision Azure Storage Account and automate file upload and deletion using PowerShell”

Navigate Visual Studio Team Services Projects like a file system using PowerShell

Visual Studio Team Services or VSTS is a great tool for continuous integration and continuous deployment. It is a cloud based SaaS offering from Microsoft. So most of the time you would be navigating it using a web browser like google chrome, firefox or Edge. In this blog post, we will learn how to treat VSTS like a file system using PowerShell.


You must have PowerShell version 5 or later or PowerShell core installed on your operating system for this to work.
Continue reading “Navigate Visual Studio Team Services Projects like a file system using PowerShell”

Copy files to/from remote machine using PowerShell Remoting

It is easy to copy files from one network share to another. This can be done using either some kind of GUI tool or command line tool like PowerShell or robocopy. However you may not want to open SMB ports on a machine for obvious security reasons. More so is true of cloud hosted virtual machines.  In such a case, you can also copy files from your local machine to remote machine or vice versa using PowerShell remoting. In this blog post, we are going to discuss the steps to do the same.

Configure Remote machine for PowerShell Remoting

If you have PowerShell v3 installed on the remote machine, configuring it for PowerShell Remoting is easy. Just run below command on the administrative PowerShell window:
Continue reading “Copy files to/from remote machine using PowerShell Remoting”

Auto assembly versioning in Visual Studio Team Services (or VSTS) build

Whenever a new .NET assembly project is created in Visual Studio, a file named AssemblyInfo is created that contains attributes used to define the version of the assembly during compilation. Using assembly versions effectively enables various team members to identify deployed assemblies and helps troubleshoot problems that may occur in a particular environment (e.g. Development, Test, or Production).

When building the solution, there are two version numbers that need to be considered: the file version number and the .NET assembly version number. As part of the best practices, the AssemblyFileVersion attribute should be incremented automatically as part of the build process. It is therefore intended to uniquely identify a build. The AssemblyVersion attribute is the version that .NET uses when linking assemblies. In this blog post, we’ll learn how to use the build process to auto specify the AssemblyFileVersion and AssemblyInformationalVersion.

Continue reading “Auto assembly versioning in Visual Studio Team Services (or VSTS) build”