In this script you explicitly create a resource group and then deploy the template to that resource group. Depending on the content of the template because there is also cross resource group deployment.

Resource group in an ARM Template

Since a couple of weeks it isn’t necessary anymore to create a resource group before you deploy a template. You are now able to add the resource group creation in the template.

Azure CLI

The script used for the deployment is shown below. I’m not certain why the “-l” is required. Normally it stands for the location but in the template you also specify a location. That location is used as the location of the resource group.