Коммит
8b7162c769
|
@ -1,19 +1,53 @@
|
|||
param($labFilesName="")
|
||||
|
||||
# Install SSMS
|
||||
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
|
||||
choco install sql-server-management-studio -y
|
||||
|
||||
# Download Lab Files
|
||||
$labFilesFolder = "C:\MCW"
|
||||
if ([string]::IsNullOrEmpty($labFilesName) -eq $false)
|
||||
{
|
||||
Write-Host "Make sure folder exists"
|
||||
if ((Test-Path $labFilesFolder) -eq $false)
|
||||
{
|
||||
New-Item -Path $labFilesFolder -ItemType directory
|
||||
function Disable-InternetExplorerESC {
|
||||
$AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
|
||||
$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
|
||||
Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 -Force
|
||||
Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 -Force
|
||||
Stop-Process -Name Explorer -Force
|
||||
Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host "Extract .ZIP file..."
|
||||
Expand-Archive -Path $labFilesName -DestinationPath $labFilesFolder -Force
|
||||
function Wait-Install {
|
||||
$msiRunning = 1
|
||||
$msiMessage = ""
|
||||
while($msiRunning -ne 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
$Mutex = [System.Threading.Mutex]::OpenExisting("Global\_MSIExecute");
|
||||
$Mutex.Dispose();
|
||||
$DST = Get-Date
|
||||
$msiMessage = "An installer is currently running. Please wait...$DST"
|
||||
Write-Host $msiMessage
|
||||
$msiRunning = 1
|
||||
}
|
||||
catch
|
||||
{
|
||||
$msiRunning = 0
|
||||
}
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
}
|
||||
|
||||
# To resolve the error of https://github.com/microsoft/MCW-App-modernization/issues/68. The cause of the error is Powershell by default uses TLS 1.0 to connect to website, but website security requires TLS 1.2. You can change this behavior with running any of the below command to use all protocols. You can also specify single protocol.
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Ssl3
|
||||
[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3"
|
||||
|
||||
# Disable IE ESC
|
||||
Disable-InternetExplorerESC
|
||||
|
||||
# Download and extract the starter solution files
|
||||
# ZIP File sometimes gets corrupted
|
||||
New-Item -ItemType directory -Path C:\MCW
|
||||
Expand-Archive -Path $labFilesName -DestinationPath 'C:\MCW' -Force
|
||||
|
||||
# Download and install SQL Server Management Studio
|
||||
Wait-Install
|
||||
(New-Object System.Net.WebClient).DownloadFile('https://aka.ms/ssmsfullsetup', 'C:\SSMS-Setup.exe')
|
||||
$pathArgs = {C:\SSMS-Setup.exe /Install /Quiet /Norestart /Logs logSSMS.txt}
|
||||
Invoke-Command -ScriptBlock $pathArgs
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
}
|
||||
},
|
||||
"variables": {
|
||||
"GitHubScriptRepo": "microsoft/MCW-Modern-cloud-apps",
|
||||
"GitHubScriptRepoBranch": "master",
|
||||
"GitHubScriptRepoBranchURL": "[concat('https://raw.githubusercontent.com/', variables('GitHubScriptRepo'), '/', variables('GitHubScriptRepoBranch'), '/Hands-on lab/')]",
|
||||
|
||||
"uniqueString": "[uniqueString(resourceGroup().id)]",
|
||||
|
||||
|
@ -30,9 +28,9 @@
|
|||
"subnetRef": "[concat(variables('vnetId'), '/subnets/', variables('subnetName'))]",
|
||||
|
||||
"labVMCustomScriptFilename": "setup-labvm.ps1",
|
||||
"labVMCustomScriptUri": "[concat(variables('GitHubScriptRepoBranchURL'), '/scripts/labvm/', variables('labVMCustomScriptFilename'))]",
|
||||
"labVMCustomScriptUri": "[concat('https://raw.githubusercontent.com/microsoft/MCW-Modern-cloud-apps/', variables('GitHubScriptRepoBranch'),'/Hands-on%20lab/scripts/labvm/', variables('labVMCustomScriptFilename'))]",
|
||||
"labVMLabFilesName": "Modern%20Cloud%20Apps%20Student%20Files.zip",
|
||||
"labVMLabFilesUri": "[concat(variables('GitHubScriptRepoBranchURL'), '/Lab-files/', variables('labVMLabFilesName'))]",
|
||||
"labVMLabFilesUri": "[concat('https://raw.githubusercontent.com/microsoft/MCW-Modern-cloud-apps/', variables('GitHubScriptRepoBranch'),'/Hands-on%20lab/Lab-files/', variables('labVMLabFilesName'))]",
|
||||
|
||||
"virtualMachineSize": "Standard_D4s_v3",
|
||||
"virtualMachineImageReference": {
|
||||
|
@ -176,10 +174,10 @@
|
|||
},
|
||||
"resources": [
|
||||
{
|
||||
"name": "CustomSciptExtension1",
|
||||
"name": "SetupLabVM",
|
||||
"type": "extensions",
|
||||
"location": "[resourceGroup().location]",
|
||||
"apiVersion": "2016-03-30",
|
||||
"apiVersion": "2019-03-01",
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Compute/virtualMachines', variables('virtualMachineName'))]"
|
||||
],
|
||||
|
@ -189,14 +187,14 @@
|
|||
"properties": {
|
||||
"publisher": "Microsoft.Compute",
|
||||
"type": "CustomScriptExtension",
|
||||
"typeHandlerVersion": "1.8",
|
||||
"autoUpgradeMinorVersion": false,
|
||||
"typeHandlerVersion": "1.9",
|
||||
"autoUpgradeMinorVersion": true,
|
||||
"settings": {
|
||||
"fileUris": [
|
||||
"[variables('labVMCustomScriptUri')]",
|
||||
"[variables('labVMLabFilesUri')]"
|
||||
],
|
||||
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ./', variables('labVMCustomScriptFilename'), ' -labFilesName \"', variables('labVMLabFilesName'), '\"')]"
|
||||
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ', variables('labVMCustomScriptFilename'), ' -labFilesName \"', variables('labVMLabFilesName'), '\"')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче