36 lines
778 B
PowerShell
36 lines
778 B
PowerShell
|
Function Test-IsServiceFabricServer {
|
||
|
<#
|
||
|
.SYNOPSIS
|
||
|
Used to determine if the current server is a Service Fabric server.
|
||
|
#>
|
||
|
[CmdletBinding()]
|
||
|
[OutputType([bool])]
|
||
|
param(
|
||
|
)
|
||
|
|
||
|
$serverRole = Get-ServerRoleEnvironmentalVariable
|
||
|
|
||
|
# Check Environmental Variables first
|
||
|
if ($serverRole -eq "fabric") {
|
||
|
|
||
|
return $true
|
||
|
} elseif ($serverRole -match ("^(web|app|microservice)$")) {
|
||
|
|
||
|
return $false
|
||
|
}
|
||
|
|
||
|
# Then let's check the server name
|
||
|
if ($env:ComputerName.StartsWith("FAB")) {
|
||
|
|
||
|
return $true;
|
||
|
}
|
||
|
|
||
|
# If all else fails, check the alk:role tag if this is an AWS instance
|
||
|
if ((Test-IsAws) -and ((Get-CurrentInstanceTags "alk:role" -ValueOnly) -eq "app:fab")) {
|
||
|
|
||
|
return $true
|
||
|
}
|
||
|
|
||
|
return $false
|
||
|
}
|