-
Notifications
You must be signed in to change notification settings - Fork 0
/
1 - AzureFileSyncAgent.ps1
95 lines (77 loc) · 2.86 KB
/
1 - AzureFileSyncAgent.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Configuration HybridFileServer
{
param (
$AzureCredential = (Get-Credential)
)
Import-DscResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion 8.4.0.0
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName PackageManagement -ModuleVersion 1.3.1
Import-DscResource -ModuleName AzureFileSyncDsc -ModuleVersion 1.0.0.3
Import-DscResource -ModuleName StorageDsc -ModuleVersion 4.4.0.0
Node FS01 {
Service FileSyncService
{
Name = "FileSyncSvc"
State = "Running"
DependsOn = "[Package]FileSync"
}
xRemoteFile FileSyncPackage {
Uri = "https://download.microsoft.com/download/1/8/D/18DC8184-E7E2-45EF-823F-F8A36B9FF240/StorageSyncAgent_V4_WS2019.msi"
DestinationPath = "C:\Windows\Temp\StorageSyncAgent.msi"
}
Package FileSync {
Ensure = "Present"
Path = "C:\Windows\Temp\StorageSyncAgent.msi"
Name = "Storage Sync Agent"
ProductId = "F5EA481D-EECC-4AA8-B62D-108001DA2462"
Arguments = '/quiet'
DependsOn = "[xRemoteFile]FileSyncPackage"
}
PackageManagement AzureRMPowerShellModule {
Name = 'AzureRM'
ProviderName = 'PowerShellGet'
RequiredVersion = '6.13.1'
Source = 'PSGallery'
DependsOn = "[Package]FileSync"
}
AzureFileSyncAgent Registration {
AzureSubscriptionId = 'c0fda861-1234-5678-9ede-fa1908101500'
AzureFileSyncResourceGroup = 'File-Sync-Rg'
AzureFileSyncInstanceName = 'FileSync01'
AzureCredential = $AzureCredential
DependsOn = '[Service]FileSyncService'
}
WaitForDisk Disk1
{
DiskId = 1
RetryIntervalSec = 60
RetryCount = 60
DependsOn = '[AzureFileSyncAgent]Registration'
}
Disk DVolume
{
DiskId = 1
DriveLetter = 'D'
Size = 100GB
DependsOn = '[WaitForDisk]Disk1'
}
File DirectoryDemoData
{
Ensure = "Present" # Ensure the directory is Present on the target node.
Type = "Directory" # The default is File.
DestinationPath = "D:\NICDemoData"
DependsOn = '[Disk]DVolume'
}
AzureFileSyncServerEndpoint DemoData {
AzureSubscriptionId = 'c0fda861-1234-5678-9ede-fa1908101500'
AzureFileSyncResourceGroup = 'File-Sync-Rg'
AzureFileSyncInstanceName = 'FileSync01'
AzureFileSyncGroup = 'FileServers'
AzureCredential = $AzureCredential
ServerLocalPath = "D:\NICDemoData"
CloudTiering = $true
TierFilesOlderThanDays = '365'
DependsOn = '[File]DirectoryDemoData'
}
}
}