@@ -9,7 +9,10 @@ This script downloads, installs and launches cosmosdb-emulator.
9
9
Uri for downloading the cosmosdb-emulator
10
10
11
11
. PARAMETER StartParameters
12
- Parameter with which to launch the cosmosdb-emulator
12
+ Parameter with which to launch the cosmosdb-emulator\
13
+
14
+ . PARAMETER Emulator
15
+ Exact path to Microsoft.Azure.Cosmos.Emulator.exe
13
16
14
17
. PARAMETER Stage
15
18
Determines what part of the script to run. Has to be either Install or Launch
@@ -18,6 +21,7 @@ Determines what part of the script to run. Has to be either Install or Launch
18
21
Param (
19
22
[string ] $EmulatorMsiUrl = " https://aka.ms/cosmosdb-emulator" ,
20
23
[string ] $StartParameters ,
24
+ [string ] $Emulator ,
21
25
[Parameter (Mandatory = $True )]
22
26
[ValidateSet (' Install' , ' Launch' )]
23
27
[string ] $Stage
@@ -26,7 +30,11 @@ Param (
26
30
$targetDir = Join-Path $Env: Temp AzureCosmosEmulator
27
31
$logFile = Join-Path $Env: Temp log.txt
28
32
$productName = " Azure Cosmos DB Emulator"
29
- $emulator = (Join-Path $targetDir (Join-Path $productName " Microsoft.Azure.Cosmos.Emulator.exe" ))
33
+
34
+ if ([string ]::IsNullOrEmpty($Emulator ))
35
+ {
36
+ $Emulator = (Join-Path $targetDir (Join-Path $productName " Microsoft.Azure.Cosmos.Emulator.exe" ))
37
+ }
30
38
31
39
if ($Stage -eq " Install" )
32
40
{
@@ -58,19 +66,19 @@ if ($Stage -eq "Install")
58
66
}
59
67
60
68
Write-Host " Getting Cosmos DB Emulator Version"
61
- $fileVersion = Get-ChildItem $emulator
62
- Write-Host $emulator $fileVersion.VersionInfo
69
+ $fileVersion = Get-ChildItem $Emulator
70
+ Write-Host $Emulator $fileVersion.VersionInfo
63
71
}
64
72
65
73
if ($Stage -eq " Launch" )
66
74
{
67
75
Write-Host " Launching Cosmos DB Emulator"
68
- if (! (Test-Path $emulator )) {
69
- Write-Error " The emulator is not installed where expected at '$emulator '"
76
+ if (! (Test-Path $Emulator )) {
77
+ Write-Error " The emulator is not installed where expected at '$Emulator '"
70
78
return
71
79
}
72
80
73
- $process = Start-Process $emulator - ArgumentList " /getstatus" - PassThru - Wait
81
+ $process = Start-Process $Emulator - ArgumentList " /getstatus" - PassThru - Wait
74
82
switch ($process.ExitCode ) {
75
83
1 {
76
84
Write-Host " The emulator is already starting"
@@ -97,8 +105,8 @@ if ($Stage -eq "Launch")
97
105
$argumentList = " /noexplorer /noui /enablepreview /disableratelimiting /enableaadauthentication"
98
106
}
99
107
100
- Write-Host " Starting emulator process: $emulator $argumentList "
101
- $process = Start-Process $emulator - ArgumentList $argumentList - ErrorAction Stop - PassThru
108
+ Write-Host " Starting emulator process: $Emulator $argumentList "
109
+ $process = Start-Process $Emulator - ArgumentList $argumentList - ErrorAction Stop - PassThru
102
110
Write-Host " Emulator process started: $ ( $process.Name ) , $ ( $process.FileVersion ) "
103
111
104
112
$Timeout = 600
@@ -117,7 +125,7 @@ if ($Stage -eq "Launch")
117
125
}
118
126
119
127
do {
120
- $process = Start-Process $emulator - ArgumentList " /getstatus" - PassThru - Wait
128
+ $process = Start-Process $Emulator - ArgumentList " /getstatus" - PassThru - Wait
121
129
switch ($process.ExitCode ) {
122
130
1 {
123
131
Write-Host " The emulator is starting"
0 commit comments