-
Notifications
You must be signed in to change notification settings - Fork 8
/
sitecore9.commerce.azure.sas.ps1
131 lines (109 loc) · 3.02 KB
/
sitecore9.commerce.azure.sas.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#requires -RunAsAdministrator
#requires -Version 5.1
#requires -module Azure
#requires -module AzureRm.Profile
#requires -module AzureRm.Storage
#requires -module AzureRm.KeyVault
#requires -module SitecoreInstallExtensions
#requires -module SitecoreInstallAzure
# To be sure that proper version of SIF is used
Remove-Module SitecoreInstallFramework
Import-Module SitecoreInstallFramework -RequiredVersion 1.2.1
#region Steps implementation
class Steps
{
[string] $Path
$Steps = @()
Steps ([string] $path)
{
$this.Path = $path -replace "ps1","steps.json"
if( (Test-Path $this.Path) )
{
$this.Steps = (Get-Content -Path $this.Path -Raw) | ConvertFrom-Json
}
else
{
$this.Steps = @()
}
}
# mark step as executed
Executed([string] $stepName)
{
$this.Steps += $stepName
$json = ConvertTo-Json -InputObject $this.Steps
Set-Content -Path $this.Path -Value $json
}
[bool] IsNotExecuted([string] $stepName)
{
return -not ($this.Steps.Contains($stepName))
}
}
#endregion
If(![Environment]::Is64BitProcess)
{
Write-Host "Please run 64-bit PowerShell" -foregroundcolor "yellow"
return
}
#define parameters
$LocalStorage = "$PSScriptRoot\Storage"
$GitHubRoot = "https://raw.githubusercontent.com/SoftServeInc/SitecoreInstallExtensions/master/Configuration/"
$prefix = "sc9u2"
$sitecoreSiteName = "$prefix.local"
$XConnectCollectionService = "$prefix.xconnect"
$SolrHost = "solr.local"
$SolrUrl = "https://solr.local:8983/solr"
$SolrRoot = "C:\solr\solr-6.6.2"
$SolrService = "PSSolrService"
$SqlServer = "$env:computername" #OR "SQLServerName\SQLInstanceName"
$SqlAdminUser = ""
# for password use '' not ""
$SqlAdminPassword= ''
$AzureStorageUrl = ""
$AzureStorageToken = ""
# Choose version for download
$SitecoreVersion = "9.0.2"
# Do not display progress (performance improvement)
$global:ProgressPreference = 'silentlyContinue'
# initialize steps functionality
$steps = [Steps]::new($MyInvocation.MyCommand.Source)
#region "Download Artifacts"
Invoke-WebRequest -Uri "$GitHubRoot/xcommerce9.azure.sas.json" -OutFile "$PSScriptRoot\xcommerce9.azure.json"
$downloadPrerequisites =@{
Path = "$PSScriptRoot\xcommerce9.azure.json"
LocalStorage = $LocalStorage
StorageUrl = $AzureStorageUrl
StorageSas = $AzureStorageToken
SitecoreVersion = $SitecoreVersion
}
try
{
if( $steps.IsNotExecuted("downloadSitecorePrerequisites") )
{
Install-SitecoreConfiguration @downloadPrerequisites
$steps.Executed("downloadSitecorePrerequisites")
}
}
catch
{
throw
}
#endregion
#region "Install Prerequisites"
Invoke-WebRequest -Uri "$GitHubRoot/xcommerce9.prerequisites.json" -OutFile "$PSScriptRoot\xcommerce9.prerequisites.json"
$installPrerequisites = @{
Path = "$PSScriptRoot\xcommerce9.prerequisites.json"
LocalStorage = $LocalStorage
}
try
{
if( $steps.IsNotExecuted("installPrerequisites") )
{
Install-SitecoreConfiguration @installPrerequisites
$steps.Executed("installPrerequisites")
}
}
catch
{
throw
}
#endregion