Created
August 3, 2019 05:17
-
-
Save janegilring/87b812bbb1dbfc1035a9d843a1b86f41 to your computer and use it in GitHub Desktop.
Example of using the AzureFileSyncAgent DSC resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.2.4 | |
Import-DscResource -ModuleName AzureFileSyncAgentDsc -ModuleVersion 1.1.5 | |
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 = 'Az' | |
ProviderName = 'PowerShellGet' | |
RequiredVersion = '2.5.0' | |
Source = 'PSGallery' | |
DependsOn = "[Package]FileSync" | |
} | |
AzureFileSyncAgent Registration { | |
AzureSubscriptionId = 'c0fda861-1234-5678-9ede-fa1908101500' | |
AzureFileSyncResourceGroup = 'File-Sync-Rg' | |
AzureFileSyncInstanceName = 'FileSync01' | |
AzureCredential = $AzureCredential | |
DependsOn = '[Service]FileSyncService' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment