Skip to content
This repository was archived by the owner on Nov 10, 2017. It is now read-only.

Commit ad5920d

Browse files
committed
Implemented issue #1.
1 parent dd8e8be commit ad5920d

File tree

1 file changed

+130
-54
lines changed

1 file changed

+130
-54
lines changed

src/Sitecore.Azure/Sitecore.Azure.psm1

Lines changed: 130 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Exports a database schema and user data from a SQL Server to a BACPAC package (.bacpac file).
1+
# Exports a database schema and user data from a local SQL Server to a BACPAC package (.bacpac file).
22
function Export-SitecoreAzureSqlDatabase
33
{
44
param([Parameter(Position=0, Mandatory = $true)]
@@ -451,22 +451,141 @@ function Get-SitecoreAzureSqlDatabaseConnectionString
451451

452452
<#
453453
.SYNOPSIS
454-
Describe the function here
454+
Publishes one or more Sitecore SQL Server databases.
455455
456456
.DESCRIPTION
457-
Describe the function in more detail
457+
The Publish-SitecoreSqlDatabase cmdlet publishes one or more Sitecore SQL Server databases from a local SQL Server to Azure SQL Database Server.
458+
459+
This command creates the following Azure Resources, which are grouped in a single Resource Group using the same Azure data center location:
460+
461+
- Resource Group
462+
- Storage Account
463+
- SQL Database Server
464+
- SQL Databases
458465
459-
.EXAMPLE
460-
Give an example of how to use it
466+
This command exports databases from a local SQL Server to a BACPAC packages (.bacpac files), and uploads to a Blob Container of a Storage Account. Initiates an import operation from Azure Blob storage to an Azure SQL Database.
467+
468+
.Link
469+
https://github.com/olegburov/Sitecore-Azure-PowerShell/
461470
471+
.PARAMETER SqlServerName
472+
Specifies the name of the local SQL Server the databases are in. The name must be in the following format {ComputerName}\{InstanceName}, such as "Oleg-PC\SQLEXPRESS".
473+
474+
.PARAMETER SqlServerAdminLogin
475+
Specifies the SQL Server administrator name for the local server.
476+
477+
.PARAMETER SqlServerPassword
478+
Specifies the SQL Server administrator password for the local server.
479+
480+
.PARAMETER SqlServerDatabaseList
481+
Specifies the list of the database names to retrieve from a local server.
482+
483+
.PARAMETER AzureResourceGroupName
484+
Specifies the name of the resource group in which to create Storage Account, SQL Server and SQL Databases are created. The resource name must be unique in the subscription.
485+
486+
.PARAMETER AzureResourceGroupLocation
487+
Specifies the location of the resource group. Enter an Azure data center location, such as "West US" or "Southeast Asia". You can place a resource group in any location.
488+
489+
.PARAMETER AzureStorageAccountName
490+
Specifies the name of the new Storage Account. The storage name must be globally unique.
491+
492+
.PARAMETER AzureSqlServerName
493+
Specifies the name of the new SQL Database server. The server name must be globally unique.
494+
495+
.PARAMETER AzureSqlServerAdminLogin
496+
Specifies the SQL Database server administrator name for the new server.
497+
498+
.PARAMETER AzureSqlServerPassword
499+
Specifies the SQL Database server administrator password for the new server.
500+
501+
502+
503+
.EXAMPLE
504+
PS C:\> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" -SqlServerAdminLogin "sa" -SqlServerPassword "12345" -SqlServerDatabaseList @("sc81initial_core", "sc81initial_master", "sc81initial_web")
505+
506+
This command publishes the SQL Server database "sc81initial_core", "sc81initial_master" and "sc81initial_web" from the local SQL Server "Oleg-PC\SQLEXPRESS" to an Azure SQL Database Server.
507+
508+
509+
510+
DatabaseName : sc81initial_core
511+
ConnectionString : Server=tcp:sitecore-azure-50876f04.database.secure.windows.net,1433;Database=sc81initial_core;User
512+
ID=sitecore@sitecore-azure-50876f04;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
513+
514+
DatabaseName : sc81initial_master
515+
ConnectionString : Server=tcp:sitecore-azure-50876f04.database.secure.windows.net,1433;Database=sc81initial_master;User
516+
ID=sitecore@sitecore-azure-50876f04;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
517+
518+
DatabaseName : sc81initial_web
519+
ConnectionString : Server=tcp:sitecore-azure-50876f04.database.secure.windows.net,1433;Database=sc81initial_web;User
520+
ID=sitecore@sitecore-azure-50876f04;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
521+
462522
.EXAMPLE
463-
Give another example of how to use it
523+
PS C:\> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" -SqlServerAdminLogin "sa" -SqlServerPassword "12345" -SqlServerDatabaseList @("sc81initial_web") -AzureResourceGroupName "My-Company-Name" -AzureResourceGroupLocation "Australia East"
524+
525+
This command publishes the SQL Server databases "sc81initial_web" from the local SQL Server "Oleg-PC\SQLEXPRESS" to an Azure SQL Database Server in the Resource Group "My-Company-Name" at the Azure data center "Australia East".
526+
527+
528+
529+
DatabaseName : sc81initial_web
530+
ConnectionString : Server=tcp:sitecore-azure-50876f04.database.secure.windows.net,1433;Database=sc81initial_web;User
531+
ID=sitecore@sitecore-azure-50876f04;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
532+
533+
.EXAMPLE
534+
PS C:\> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" -SqlServerAdminLogin "sa" -SqlServerPassword "12345" -SqlServerDatabaseList @("sc81initial_core", "sc81initial_web") -AzureStorageAccountName "mycompanyname"
535+
536+
This command publishes 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).
464537
465-
.PARAMETER computername
466-
The computer name to query. Just one.
538+
539+
540+
DatabaseName : sc81initial_core
541+
ConnectionString : Server=tcp:sitecore-azure-50876f04.database.secure.windows.net,1433;Database=sc81initial_core;User
542+
ID=sitecore@sitecore-azure-50876f04;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
543+
544+
DatabaseName : sc81initial_web
545+
ConnectionString : Server=tcp:sitecore-azure-50876f04.database.secure.windows.net,1433;Database=sc81initial_web;User
546+
ID=sitecore@sitecore-azure-50876f04;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
547+
548+
.EXAMPLE
549+
PS C:\> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" -SqlServerAdminLogin "sa" -SqlServerPassword "12345" -SqlServerDatabaseList @("sc81initial_core", "sc81initial_master", "sc81initial_web") -AzureSqlServerName "sitecore-azure" -AzureSqlServerAdminLogin "sitecore" -AzureSqlServerPassword "Experienc3!"
550+
551+
This command publishes 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 in the Azure data center "West Europe".
467552
468-
.PARAMETER logname
469-
The name of a file to write failed computer names to. Defaults to errors.txt.
553+
554+
555+
DatabaseName : sc81initial_core
556+
ConnectionString : Server=tcp:sitecore-azure.database.secure.windows.net,1433;Database=sc81initial_core;User
557+
ID=sitecore@sitecore-azure;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
558+
559+
DatabaseName : sc81initial_master
560+
ConnectionString : Server=tcp:sitecore-azure.database.secure.windows.net,1433;Database=sc81initial_master;User
561+
ID=sitecore@sitecore-azure;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
562+
563+
DatabaseName : sc81initial_web
564+
ConnectionString : Server=tcp:sitecore-azure.database.secure.windows.net,1433;Database=sc81initial_web;User
565+
ID=sitecore@sitecore-azure;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
566+
567+
.EXAMPLE
568+
PS C:\> Publish-SitecoreSqlDatabase -SqlServerName "Oleg-PC\SQLEXPRESS" -SqlServerAdminLogin "sa" -SqlServerPassword "12345" -SqlServerDatabaseList @("sc81initial_core", "sc81initial_master", "sc81initial_web", "sc81initial_reporting") -AzureResourceGroupName "My-Company-Name" -AzureResourceGroupLocation "West Europe" -AzureStorageAccountName "mycompanyname" -AzureSqlServerName "sitecore-azure" -AzureSqlServerAdminLogin "sitecore" -AzureSqlServerPassword "Experienc3!"
569+
570+
This command publishes the SQL Server databases "sc81initial_core", "sc81initial_master" and "sc81initial_web" from the local SQL Server "Oleg-PCU\SQLEXPRESS" to Azure SQL Database Server "sitecore-azure" in the Resource Group "My-Company-Name" at the Azure data center "West Europe" using the Azure Storage Account "mycompanyname".
571+
572+
573+
574+
DatabaseName : sc81initial_core
575+
ConnectionString : Server=tcp:sitecore-azure.database.secure.windows.net,1433;Database=sc81initial_core;User
576+
ID=sitecore@sitecore-azure;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
577+
578+
DatabaseName : sc81initial_master
579+
ConnectionString : Server=tcp:sitecore-azure.database.secure.windows.net,1433;Database=sc81initial_master;User
580+
ID=sitecore@sitecore-azure;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
581+
582+
DatabaseName : sc81initial_web
583+
ConnectionString : Server=tcp:sitecore-azure.database.secure.windows.net,1433;Database=sc81initial_web;User
584+
ID=sitecore@sitecore-azure;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
585+
586+
DatabaseName : sc81initial_reporting
587+
ConnectionString : Server=tcp:sitecore-azure.database.secure.windows.net,1433;Database=sc81initial_reporting;User
588+
ID=sitecore@sitecore-azure;Password=Experienc3!;Trusted_Connection=False;Encrypt=True;Connection Timeout=30
470589
#>
471590
function Publish-SitecoreSqlDatabase
472591
{
@@ -561,47 +680,4 @@ function Publish-SitecoreSqlDatabase
561680
Remove-Item $outputDirectory -Recurse -Force
562681
}
563682

564-
Export-ModuleMember -Function Publish-SitecoreSqlDatabase -Alias *
565-
566-
<#
567-
$path = "C:\Program Files\WindowsPowerShell\Modules\Sitecore.Azure\Sitecore.Azure.psd1"
568-
569-
$guid = [guid]::NewGuid().guid
570-
571-
$paramHash = @{
572-
Path = $path
573-
RootModule = ".\Sitecore.Azure.psm1"
574-
ModuleVersion = "0.5.0"
575-
Guid = $guid
576-
Author = "Oleg Burov"
577-
CompanyName = "Sitecore Corporation"
578-
Copyright = "Copyright © 2015 Sitecore Corporation ."
579-
Description = "Suitecore Azure Module"
580-
PowerShellVersion = "3.0"
581-
PowerShellHostName = ""
582-
PowerShellHostVersion = $null
583-
DotNetFrameworkVersion = "4.0"
584-
CLRVersion="4.0"
585-
ProcessorArchitecture = "None"
586-
RequiredModules = @(
587-
@{ ModuleName = "AzureRM"; ModuleVersion = "1.0.2"},
588-
@{ ModuleName = "AzureRM.profile"; ModuleVersion = "1.0.1"},
589-
@{ ModuleName = "AzureRM.Resources"; ModuleVersion = "1.0.1"},
590-
@{ ModuleName = "AzureRM.Storage"; ModuleVersion = "1.0.1"},
591-
@{ ModuleName = "AzureRM.Sql"; ModuleVersion = "1.0.1"}
592-
)
593-
RequiredAssemblies = @()
594-
ScriptsToProcess = @()
595-
TypesToProcess = @()
596-
FormatsToProcess = @()
597-
NestedModules = @()
598-
FunctionsToExport = "Publish-SitecoreSqlDatabase"
599-
CmdletsToExport = ""
600-
VariablesToExport = ""
601-
AliasesToExport = @()
602-
ModuleList = @()
603-
FileList = @()
604-
PrivateData = $null
605-
}
606-
New-ModuleManifest @paramHash
607-
#>
683+
Export-ModuleMember -Function Publish-SitecoreSqlDatabase -Alias *

0 commit comments

Comments
 (0)