Deploy projects using PowerShell scripts

You can also deploy your project to Azure Web Apps using PowerShell scripts.

You can download the scripts from Sitefinity GitHub repository » Sitefinity Azure PowerShell Deployment Scripts.

The scripts perform the following:

  • Create SQL server in Azure
  • Create SQL database in Azure under the SQL server
  • Create Azure Web App 
  • Create resource group for the site
  • Create Redis cache 
  • Set Redis key in Sitefinity
  • Prepare and deploy Sitefintiy website to Azure Web Apps

Azure resource groups 

To deploy Sitefinity to Azure Web Apps, the PowerShell scripts use the predefined JSON templates, located in folder ~/Scripts/Templates.

Before you run the scripts, you can reorganize or create new templates, using Azure Resource Manager. Azure Resource Manager helps you to manage Azure resource groups.

A resource group is a container that holds related resources for an application. The resource group could include all of the resources for an application, or only those resources that are logically grouped together. You can decide how you want to allocate resources to resource groups based on what makes the most sense for your organization. Azure Resource Manager templates enable you to quickly and easily provision your applications in Azure via declarative JSON. In a single JSON template, you can deploy multiple services, such as Virtual Machines, Virtual Networks, Storage, App Services, and databases. To simplify management of your application, you can organize all of the resources that share a common lifecycle into a single resource group.

Default resource group

The resource group that is used by the scripts, contains the following resources:

  • WebApp 
  • SQL server
  • SQL database
  • Redis cache

You can modify this group or create a new one.

Create your own resource group

To create a resource group use the CreateSitefinityAzureResourceGroup.ps1, located in ~/Scripts folder. You must specify the following parameters: 

  • WebsiteRootDirectory 
  • DatabaseName
  • SqlServer
  • ResourceGroupName
  • AzureAccount
  • AzureAccountPassword
  • ResourceGroupLocation
  • TemplateFile
  • TemplateParameterFile

IMPORTANT: AzureResourceManager module requires Add-AzureAccount. A Publish settings file is not sufficient. Microsoft account cannot be used with PowerShell credential object with the Add-AzureAccount command. For this purpose you must use an Azure user. For more information, see How to install and configure Azure PowerShell.

NOTE: There is a resource group template file ~/Scripts/Templates/Default.json that you can use. You must also specify the resource group template parameters, such as site name, SQL, hosting plan parameters, etc.,  in the Default.params.json template parameter file under the same folder.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?