Azure Locks – How to prevent accidental deletion of azure resources

Microsoft Azure offers a feature known as ‘Locks’. It enables to prevent deletion and applying unexpected changes to azure resources accidentally. By default, Owner and User administrators have access to apply Locks.

There are two types of Locks: CanNotDelete and ReadOnly

CanNotDelete means authorized users can still read and modify a resource, but they can’t delete the resource.

ReadOnly means authorized users can read a resource, but they can’t delete or update the resource. Applying this lock is similar to restricting all authorized users to the permissions granted by the Reader role

You can apply locks on followings levels in Azure

  1. Subscription
  2. Resource Group
  3. Resource

How to apply Locks?

Go to Azure Portal and select the resource. In my case I am applying it at resource level (SQL database).

Azure Locks
How to find locks

Under settings, click on ‘Locks’ to open the blade, enter the lock details and click on ‘Add’.

Azure Locks
Adding Lock

Once the lock is created, go to resource and click on delete. Azure will give you an error message saying delete operation can not be performed because it is locked.

Now we know what locks are and what they do. We can apply them on all kind of resources. Especially on resources which if deleted can not be recovered. For example, storage, if ‘soft delete’ is not ON, once storage account is deleted, it can not be recovered. Other scenario can be if you have multiple co-admins, contributors in your organisation and you want to make sure no resource is deleted accidentally, you can lock those resources. In a nutshell, locks can be used in a lot of ways and can make our life easy.

What are Minification and CDN?

Minification is the process of reducing the size of files to load content faster which results in lower bandwidth, faster results and better user experience.

Step by step minification process:

It is a very simple process:
1. Write the code in development environment.
2. Minify the file.
3. Deploy it on the server and you are ready to go.

When the user opens the web page, a minified file is sent to the client’s browser.

Minified
Minified JS file

______________________________________________________________________________

Normal JS file
Normal JS file

You may have noticed the difference between a normal and a minified file as shown in above images. When you minify a file all the white spaces are removed and long variable names are shortened. The minified file has less size which results in lower bandwidth consumption and loads web page 60% faster. There’s a difference of 150kb+ between the normal and minified version of JQUERY JS library file.

Content delivery network (CDN)

The best practice is to load all assets and JS files through CDN. There are different cloud vendors which offer CDN services like Azure CDN and AWS CDN.

CDN always cache files for better performance and request management. It’s always recommended that you version your files so when you push a new change in JS file, CDN loads a newer version.

For example: There’s a file named login.min.js?v=1.0. When you make changes in this file, update it’s version to login.min.js?v=1.1 so server always sends an updated version with new changes.

Minification Tools

There are a lot of tools available on market but following are the most popular ones.

BizSpark Program and Microsoft for Startups

Microsoft started the BizSpark program to help startups and software entrepreneurs in 2009. It offered tons of benefits like 750$ credit/month for Microsoft Azure, free access to MSDN Subscriptions in which you can use licensed software like Visual Studio, Microsoft Word, Excel, and other Microsoft products. The main aim of this program was to help entrepreneurs bring ideas to life and build product/services which can help businesses and people.

To signup for BizSpark, simply you had to fill up the form online and send the details of your idea. If the BizSpark team liked your idea, they will approve it and give you free three years access to Microsoft Azure and other products.

Recently, the BizSpark program was discontinued on February 14th, 2018 and Microsoft created a new program with the name ‘Microsoft for Startups‘. Microsoft has partnered up with startup accelerators, incubators and VCs all around the world. To sign up for this program you have to contact one of Microsoft’s local program director to learn if you can qualify for this programs exclusive benefits. Here is a list of partners which you can look on Microsofts website.

This program can really help entrepreneurs out there who are working on their ideas or are in the middle of their startup journey, they can really get benefit out of this program. I wrote this blog just to spread the word about this program or if it can help anybody. If you need further help, shoot me an email and I can get you in touch with one of local Microsoft’s representative.

 

Azure web apps support multiple frameworks n languages

Azure web app is a service which can host your site. As Microsoft is moving towards more open source approach (Microsoft has acquired GitHub) it has enhanced the capability of its cloud platform Microsoft Azure offers. Web apps support multiple frameworks and languages:

  • ASP.NET
  • ASP.NET Core
  • Java
  • Ruby
  • Node.js
  • PHP
  • Python

In order to experience and play around with these different programming languages on Microsoft Azure platform, I have set up a small project which can help you get started.

To run Python or Java code, go to Azure portal > Application settings and turn Python/Java ‘ON’ whichever you want to use as shown in the image below:

 

microsoft azure frameworks and languages