This repository contains a set of PowerShell cmdlets for developers and administrators to deploy Sitecore solutions.
It is very easy to get started with Sitecore.Azure module to deploy Sitecore databases to Microsoft Azure. You just need the following components and 10 minutes of your time.
- A work or school account / Microsoft account and a Microsoft Azure subscription with the following Azure services enabled:
- Azure Resource Group
- Azure Storage
- Azure SQL Database
- Azure SQL Database Server
- Windows PowerShell ISE or Microsoft Azure PowerShell (available on PowerShell Gallery and WebPI).
- Microsoft SQL Server 2014 or higher
- Sitecore® Experience Platform™ 8.0 or higher
Note: For basic instructions about using Windows PowerShell, see Using Windows PowerShell.
The recommended approach to deploy Sitecore databases to the Microsoft Azure SQL Database service is as follows:
-
Run either the Windows PowerShell ISE or Microsoft Azure PowerShell.
Note: You must run as an Administrator the very first time to install a module.
-
Install the Windows PowerShell Sitecore.Azure module:
PS> Install-Module -Name Sitecore.Azure
Note: The
Sitecore.Azure
module depends on the Azure Resource Manager modules, which will be installed automatically if any needed. -
Log in to authenticate cmdlets with Azure Resource Manager (ARM):
PS> Login-AzureRmAccount
-
Import a Publishing Settings file (*.publishsettings) to authenticate cmdlets with Azure Service Management (ASM):
PS> Import-AzurePublishSettingsFile -PublishSettingsFile "C:\Users\Oleg\Desktop\Visual Studio Premium with MSDN.publishsettings"
Note: To downloads a publish settings file for a Microsoft Azure subscription, use the
Get-AzurePublishSettingsFile
cmdlet. -
Now you can use the
Publish-SitecoreSqlDatabase
cmdlet to publish one or more Sitecore SQL Server databases.
-
Example 1: Publish the SQL Server databases
sc81initial_core
,sc81initial_master
,sc81initial_web
from the local SQL ServerOleg-PC\SQLEXPRESS
to an Azure SQL Database Server.PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` -SqlServerCredentials $credentials ` -SqlServerDatabaseList @("sc81initial_core", "sc81initial_master", "sc81initial_web")
-
Example 2: Publish the SQL Server databases
sc81initial_web
from the local SQL ServerOleg-PC\SQLEXPRESS
to an Azure SQL Database Server in the Resource GroupMyCompanyName
at the Azure data centerAustralia East
.PS> $credentials = Get-Credential PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` -SqlServerCredentials $credentials ` -SqlServerDatabaseList @("sc81initial_web") ` -AzureResourceGroupName "MyCompanyName" ` -AzureResourceGroupLocation AustraliaEast
Important: The Australia Regions are available to customers with a business presence in Australia or New Zealand.
-
Example 3: Publish the SQL Server databases
sc81initial_core
andsc81initial_web
from the local SQL ServerOleg-PC\SQLEXPRESS
to an Azure SQL Database Server using the Azure Storage Accountmycompanyname
for BACPAC packages (.bacpac files).PS> $password = ConvertTo-SecureString "12345" -AsPlainText -Force PS> $credentials = New-Object System.Management.Automation.PSCredential ("sa", $password) PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` -SqlServerCredentials $credentials ` -SqlServerDatabaseList @("sc81initial_core", "sc81initial_web") ` -AzureStorageAccountName "mycompanyname" ` -AzureStorageAccountType Standard_GRS
-
Example 4: Publish the SQL Server databases
sc81initial_core
,sc81initial_master
andsc81initial_web
from the local SQL ServerOleg-PC\SQLEXPRESS
to an Azure SQL Database Server with specified administrator credentials and "P1 Premium" price tier.PS> $password = ConvertTo-SecureString "12345" -AsPlainText -Force PS> $azureSqlServerCredentials = New-Object System.Management.Automation.PSCredential ("sa", $password) PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` -SqlServerCredentials $localSqlServerCredentials ` -SqlServerDatabaseList @("sc81initial_core", "sc81initial_master", "sc81initial_web") ` -AzureSqlServerName "sitecore-azure" ` -AzureSqlServerCredentials $azureSqlServerCredentials ` -AzureSqlDatabasePricingTier "P1"
-
Example 5: Publish the SQL Server databases
sc81initial_core
,sc81initial_master
,sc81initial_web
andsc81initial_reporting
from the local SQL ServerOleg-PC\SQLEXPRESS
to Azure SQL Database Serversitecore-azure
in the Resource GroupMyCompanyName
at the Azure data centerJapan East
using the Azure Storage Accountmycompanyname
.PS> $localPassword = ConvertTo-SecureString "12345" -AsPlainText -Force PS> $localSqlServerCredentials = New-Object System.Management.Automation.PSCredential ("sa", $localPassword) PS> $azurePassword = ConvertTo-SecureString "Experienc3!" -AsPlainText -Force PS> $azureSqlServerCredentials = New-Object System.Management.Automation.PSCredential ("sitecore", $azurePassword) PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` -SqlServerCredentials $localSqlServerCredentials ` -SqlServerDatabaseList @("sc81initial_core", "sc81initial_master", "sc81initial_web", "sc81initial_reporting") ` -AzureResourceGroupName "MyCompanyName" ` -AzureResourceGroupLocation JapanEast ` -AzureStorageAccountName "mycompanyname" ` -AzureSqlServerName "sitecore-azure" ` -AzureSqlServerCredentials $azureSqlServerCredentials