-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSampleConfig.ps1
81 lines (77 loc) · 2.62 KB
/
SampleConfig.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
#New Deployment
configuration WAPVMRole {
param (
[PSCredential] $Credential
)
Import-DscResource -ModuleName cWAPack
Import-DscResource -ModuleName PSDesiredStateConfiguration
node $AllNodes.NodeName {
WAPackVMRole DSCClient {
VMSize = 'Medium'
Name = 'TestDSC'
SubscriptionId = 'b5a9b263-066b-4a8f-87b4-1b7c90a5bcad'
Url = 'https://api.bgelens.nl'
Credential = $Credential
VMRoleGIName = 'DSCPullServerClient'
OSDiskSearch = 'LatestApplicable'
NetworkReference = 'Internal'
TokenSource = 'ADFS'
TokenUrl = 'https://sts.bgelens.nl'
TokenPort = 443
Ensure = 'Present'
Port = 443
VMRoleParameters = @{
VMRoleAdminCredential = 'Administrator:P@$Sw0rd!'
DSCPullServerClientConfigurationId = '7844f909-1f2e-4770-9c97-7a2e2e5677ae'
DSCPullServerClientCredential = 'Domain\certreq:Password!'
}
}
}
}
$Cred = New-Object -TypeName pscredential -ArgumentLis @('[email protected]', (ConvertTo-SecureString -String 'MySecurePWD!' -AsPlainText -Force))
$configdata = @{
AllNodes = @(
@{
NodeName = 'localhost'
PSDscAllowPlainTextPassword = $true
PSDscAllowDomainUser = $true
}
)
}
WAPVMRole -ConfigurationData $configdata -Credential $Cred
Start-DscConfiguration .\WAPVMRole -Wait -Verbose
#Remove VM Role
configuration WAPVMRolepurge {
param (
[PSCredential] $Credential
)
Import-DscResource -ModuleName cWAPack
Import-DscResource -ModuleName PSDesiredStateConfiguration
node $AllNodes.NodeName {
WAPackVMRole DSCClient {
Name = 'TestDSC'
SubscriptionId = 'b5a9b263-066b-4a8f-87b4-1b7c90a5bcad'
Url = 'https://api.bgelens.nl'
Credential = $Credential
TokenSource = 'ADFS'
TokenUrl = 'https://sts.bgelens.nl'
TokenPort = 443
Ensure = 'Absent'
Port = 443
VMRoleGIName = 'DSCPullServerClient'
NetworkReference = 'Internal'
}
}
}
$Cred = New-Object -TypeName pscredential -ArgumentLis @('[email protected]', (ConvertTo-SecureString -String 'MySecurePWD!' -AsPlainText -Force))
$configdata = @{
AllNodes = @(
@{
NodeName = 'localhost'
PSDscAllowPlainTextPassword = $true
PSDscAllowDomainUser = $true
}
)
}
WAPVMRolepurge -ConfigurationData $configdata -Credential $Cred
Start-DscConfiguration .\WAPVMRolepurge -Wait -Verbose