-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathUtilities.psm1
72 lines (49 loc) · 1.44 KB
/
Utilities.psm1
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
function LogInfo {
param ($Text)
WriteToConsole -Text $Text -LogLevel "Info" -ForegroundColor White
}
function LogError {
param ($Text)
WriteToConsole -Text $Text -LogLevel "Error" -ForegroundColor Red
}
function LogWarning {
param ($Text)
WriteToConsole -Text $Text -LogLevel "Warn" -ForegroundColor Yellow
}
function WriteToConsole {
param ($Text, $LogLevel, $ForegroundColor)
Write-Host -ForegroundColor $ForegroundColor "[$(Get-Date)] [$($LogLevel)]`t$($Text)"
}
function Get-MDWResourceGroupName {
param([parameter(Mandatory=$true)][string]$baseName)
$resourceGroupName = "$($baseName)-RG"
return $resourceGroupName
}
function Get-MDWVnetName {
param([parameter(Mandatory=$true)][string]$baseName)
$vnetName = "$($baseName)-VNet"
return $vnetName
}
function Get-MDWKeyVaultName {
param(
[parameter(Mandatory=$true)][string]$baseName,
[bool]$encrypted=$false
)
$keyVaultName = ""
if(!$encrypted) {
$keyVaultName = "$($baseName)-KV"
} else {
$keyVaultName = "$($baseName)-KV-Enc"
}
return $keyVaultName
}
function Get-MDWDataFactoryName{
param([parameter(Mandatory=$true)][string]$baseName)
$dataFactoryName = "$($baseName)-ADF"
return $dataFactoryName
}
function Get-MDWNetworkSecurityGroupName {
param([parameter(Mandatory=$true)][string]$baseName)
$nsgName = "$($baseName)-ADB-NSG"
return $nsgName
}