|
1 | 1 | # Sitecore Azure PowerShell
|
2 | 2 |
|
3 | 3 | This repository contains a set of PowerShell cmdlets for developers and administrators to deploy Sitecore solutions.
|
| 4 | + |
| 5 | +# Getting Started |
| 6 | + |
| 7 | +It is very easy to get started with Sitecore.Azure module to deploy Sitecore databases to Microsoft Azure. |
| 8 | + |
| 9 | +## Requirements: |
| 10 | +- A work or school account / Microsoft account and a Microsoft Azure subscription with the following Azure services enabled: |
| 11 | + - Azure Resource Group |
| 12 | + - Azure Storage |
| 13 | + - Azure SQL Database |
| 14 | + - Azure SQL Database Server |
| 15 | +- Windows PowerShell ISE or Microsoft Azure PowerShell (available on [PowerShell Gallery](https://www.powershellgallery.com/profiles/azure-sdk/) and [WebPI](http://aka.ms/webpi-azps/)). |
| 16 | +- Microsoft SQL Server 2014 or higher |
| 17 | +- Sitecore® Experience Platform™ 8.0 or higher |
| 18 | + |
| 19 | +> **Note:** For basic instructions about using Windows PowerShell, see [Using Windows PowerShell](http://go.microsoft.com/fwlink/p/?LinkId=321939). |
| 20 | +
|
| 21 | +## Instructions |
| 22 | + |
| 23 | +The recommended approach to deploy Sitecore databases to the [Microsoft Azure SQL Database](https://azure.microsoft.com/en-us/documentation/articles/sql-database-technical-overview/) service is as follows: |
| 24 | + |
| 25 | +1. Run either the Windows PowerShell ISE or Microsoft Azure PowerShell. |
| 26 | + |
| 27 | + > **Note:** You must run as an Administrator the very first time to install a module. |
| 28 | +
|
| 29 | +2. Install the Windows PowerShell [Sitecore.Azure](https://www.powershellgallery.com/packages/Sitecore.Azure/) module: |
| 30 | + |
| 31 | + ```PowerShell |
| 32 | + PS> Install-Module -Name Sitecore.Azure |
| 33 | + ``` |
| 34 | + |
| 35 | + > **Note:** The `Sitecore.Azure` module depends on the Azure Resource Manager modules, which will be installed automatically if any needed. |
| 36 | + |
| 37 | +3. Log in to authenticate cmdlets with Azure Resource Manager (ARM): |
| 38 | + |
| 39 | + ```PowerShell |
| 40 | + PS> Login-AzureRmAccount |
| 41 | + ``` |
| 42 | + |
| 43 | +4. Import a Publishing Settings file (*.publishsettings) to authenticate cmdlets with Azure Service Management (ASM): |
| 44 | + |
| 45 | + ```PowerShell |
| 46 | + PS> Import-AzurePublishSettingsFile -PublishSettingsFile "C:\Users\Oleg\Desktop\Visual Studio Premium with MSDN.publishsettings" |
| 47 | + ``` |
| 48 | + |
| 49 | + > **Note:** To downloads a publish settings file for a Microsoft Azure subscription, use the `Get-AzurePublishSettingsFile` cmdlet. |
| 50 | +
|
| 51 | +5. Now you can use the `Publish-SitecoreSqlDatabase` cmdlet to publish one or more Sitecore SQL Server databases. |
| 52 | + |
| 53 | +## Examples |
| 54 | + |
| 55 | +- **Example 1:** Publish the SQL Server databases `sc81initial_core`, `sc81initial_master`, `sc81initial_web` from the local SQL Server `Oleg-PC\SQLEXPRESS` to an Azure SQL Database Server. |
| 56 | + |
| 57 | + ```PowerShell |
| 58 | + PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` |
| 59 | + -SqlServerCredentials $credentials ` |
| 60 | + -SqlServerDatabaseList @("sc81initial_core", "sc81initial_master", "sc81initial_web") |
| 61 | + ``` |
| 62 | + |
| 63 | +- **Example 2:** Publish the SQL Server databases `sc81initial_web` from the local SQL Server `Oleg-PC\SQLEXPRESS` to an Azure SQL Database Server in the Resource Group `MyCompanyName` at the Azure data center `Australia East`. |
| 64 | + |
| 65 | + ```PowerShell |
| 66 | + PS> $credentials = Get-Credential |
| 67 | + |
| 68 | + PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` |
| 69 | + -SqlServerCredentials $credentials ` |
| 70 | + -SqlServerDatabaseList @("sc81initial_web") ` |
| 71 | + -AzureResourceGroupName "MyCompanyName" ` |
| 72 | + -AzureResourceGroupLocation AustraliaEast |
| 73 | + ``` |
| 74 | + |
| 75 | + > **Important:** The Australia Regions are available to customers with a business presence in Australia or New Zealand. |
| 76 | + |
| 77 | +- **Example 3:** Publish the SQL Server databases `sc81initial_core` and `sc81initial_web` from the local SQL Server `Oleg-PC\SQLEXPRESS` to an Azure SQL Database Server using the Azure Storage Account `mycompanyname` for BACPAC packages (.bacpac files). |
| 78 | + |
| 79 | + ```PowerShell |
| 80 | + PS> $password = ConvertTo-SecureString "12345" -AsPlainText -Force |
| 81 | + PS> $credentials = New-Object System.Management.Automation.PSCredential ("sa", $password) |
| 82 | + |
| 83 | + PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` |
| 84 | + -SqlServerCredentials $credentials ` |
| 85 | + -SqlServerDatabaseList @("sc81initial_core", "sc81initial_web") ` |
| 86 | + -AzureStorageAccountName "mycompanyname" ` |
| 87 | + -AzureStorageAccountType Standard_GRS |
| 88 | + ``` |
| 89 | + |
| 90 | +- **Example 4:** Publish the SQL Server databases `sc81initial_core`, `sc81initial_master` and `sc81initial_web` from the local SQL Server `Oleg-PC\SQLEXPRESS` to an Azure SQL Database Server with specified administrator credentials and "P1 Premium" price tier. |
| 91 | + |
| 92 | + ```PowerShell |
| 93 | + PS> $password = ConvertTo-SecureString "12345" -AsPlainText -Force |
| 94 | + PS> $azureSqlServerCredentials = New-Object System.Management.Automation.PSCredential ("sa", $password) |
| 95 | + |
| 96 | + PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` |
| 97 | + -SqlServerCredentials $localSqlServerCredentials ` |
| 98 | + -SqlServerDatabaseList @("sc81initial_core", "sc81initial_master", "sc81initial_web") ` |
| 99 | + -AzureSqlServerName "sitecore-azure" ` |
| 100 | + -AzureSqlServerCredentials $azureSqlServerCredentials ` |
| 101 | + -AzureSqlDatabasePricingTier "P1" |
| 102 | + ``` |
| 103 | + |
| 104 | +- **Example 5:** Publish the SQL Server databases `sc81initial_core`, `sc81initial_master`, `sc81initial_web` and `sc81initial_reporting` from the local SQL Server `Oleg-PC\SQLEXPRESS` to Azure SQL Database Server `sitecore-azure` in the Resource Group `MyCompanyName` at the Azure data center `Japan East` using the Azure Storage Account `mycompanyname`. |
| 105 | + |
| 106 | + ```PowerShell |
| 107 | + PS> $localPassword = ConvertTo-SecureString "12345" -AsPlainText -Force |
| 108 | + PS> $localSqlServerCredentials = New-Object System.Management.Automation.PSCredential ("sa", $localPassword) |
| 109 | + |
| 110 | + PS> $azurePassword = ConvertTo-SecureString "Experienc3!" -AsPlainText -Force |
| 111 | + PS> $azureSqlServerCredentials = New-Object System.Management.Automation.PSCredential ("sitecore", $azurePassword) |
| 112 | + |
| 113 | + PS> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" ` |
| 114 | + -SqlServerCredentials $localSqlServerCredentials ` |
| 115 | + -SqlServerDatabaseList @("sc81initial_core", "sc81initial_master", "sc81initial_web", "sc81initial_reporting") ` |
| 116 | + -AzureResourceGroupName "MyCompanyName" ` |
| 117 | + -AzureResourceGroupLocation JapanEast ` |
| 118 | + -AzureStorageAccountName "mycompanyname" ` |
| 119 | + -AzureSqlServerName "sitecore-azure" ` |
| 120 | + -AzureSqlServerCredentials $azureSqlServerCredentials |
| 121 | + ``` |
0 commit comments