-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds session resources from 2019 Microsoft Ignite - The Tour - Stockholm
- Loading branch information
1 parent
7c4022d
commit e4c16ad
Showing
17 changed files
with
858 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+14.9 MB
... Cloudify your Windows File Server/Jan Egil Ring - Cloudify your Windows File Server.pptx
Binary file not shown.
57 changes: 57 additions & 0 deletions
57
...m/Jan Egil Ring - Cloudify your Windows File Server/Scripts/DSC/Azure File Sync - DSC.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Install-Module -Name Az -Force | ||
|
||
Connect-AzAccount | ||
Set-AzContext -SubscriptionId 1f732d91-23e3-40c5-b17e-59a82b645596 | ||
|
||
Import-Module Az.Automation | ||
|
||
$PSDefaultParameterValues = @{ | ||
"*AzAutomation*:ResourceGroupName" = 'West-Europe-Management' | ||
"*AzAutomation*:AutomationAccountName" = 'Automation-West-Europe' | ||
} | ||
|
||
# HybridFileServers - import configuration to Azure Automation | ||
$SourcePath = '.\AzureFileSyncAgent\HybridFileServer.ps1' | ||
Import-AzAutomationDscConfiguration -SourcePath $SourcePath -Force -Published -Tags @{Source='Git'} | ||
|
||
# HybridFileServers - compile configuration in Azure Automation | ||
$ConfigurationData = Import-PowerShellDataFile -Path '.\AzureFileSyncAgent\HybridFileServer_Configuration_Data.psd1' | ||
$CompilationJob = Start-AzAutomationDscCompilationJob -ConfigurationName HybridFileServer -ConfigurationData $ConfigurationData | ||
|
||
|
||
#region DSC LCM | ||
|
||
$LCMComputerName = 'BranchFS1' | ||
$NodeConfigurationName = 'HybridFileServer.BranchFS1' | ||
$DSCMOFDirectory = 'C:\temp\AzureAutomationDscMetaConfiguration' | ||
|
||
# Create the metaconfigurations | ||
$Params = @{ | ||
RegistrationUrl = 'https://we-agentservice-prod-1.azure-automation.net/accounts/a8072ea5-60ec-4209-b9b0-64c519efbc73'; | ||
RegistrationKey = '1234567W+enQyQXHd9cKX9/FI8WOZgumoQC5ks+jXo/TBwOjxeW1k2gQywhiPHNoDUiMf6abcde'; | ||
ComputerName = @($LCMComputerName); | ||
NodeConfigurationName = $NodeConfigurationName; | ||
RefreshFrequencyMins = 720; | ||
ConfigurationModeFrequencyMins = 360; | ||
RebootNodeIfNeeded = $False; | ||
AllowModuleOverwrite = $True; | ||
ConfigurationMode = 'ApplyAndAutoCorrect'; | ||
ActionAfterReboot = 'ContinueConfiguration'; | ||
ReportOnly = $False; # Set to $True to have machines only report to AA DSC but not pull from it | ||
OutputPath = $DSCMOFDirectory | ||
} | ||
|
||
. '.\AzureAutomationDscMetaConfiguration.ps1' | ||
|
||
AzureAutomationDscMetaConfiguration @Params | ||
|
||
$LCMComputerName = $env:COMPUTERNAME | ||
$DSCMOFDirectory = 'C:\temp\AzureAutomationDscMetaConfiguration' | ||
|
||
Set-DscLocalConfigurationManager -Path $DSCMOFDirectory -ComputerName $LCMComputerName -Force | ||
|
||
Update-DscConfiguration -Wait -Verbose -CimSession $LCMComputerName | ||
|
||
Get-DscLocalConfigurationManager -CimSession $LCMComputerName | ||
|
||
#endregion |
87 changes: 87 additions & 0 deletions
87
...g - Cloudify your Windows File Server/Scripts/DSC/AzureAutomationDscMetaConfiguration.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# The DSC configuration that will generate metaconfigurations | ||
[DscLocalConfigurationManager()] | ||
Configuration AzureAutomationDscMetaConfiguration | ||
{ | ||
param | ||
( | ||
[Parameter(Mandatory=$True)] | ||
[String]$RegistrationUrl, | ||
|
||
[Parameter(Mandatory=$True)] | ||
[String]$RegistrationKey, | ||
|
||
[Parameter(Mandatory=$True)] | ||
[String[]]$ComputerName, | ||
|
||
[Int]$RefreshFrequencyMins = 30, | ||
|
||
[Int]$ConfigurationModeFrequencyMins = 15, | ||
|
||
[String]$ConfigurationMode = "ApplyAndMonitor", | ||
|
||
[String]$NodeConfigurationName, | ||
|
||
[Boolean]$RebootNodeIfNeeded= $False, | ||
|
||
[String]$ActionAfterReboot = "ContinueConfiguration", | ||
|
||
[Boolean]$AllowModuleOverwrite = $False, | ||
|
||
[Boolean]$ReportOnly | ||
) | ||
|
||
if(!$NodeConfigurationName -or $NodeConfigurationName -eq "") | ||
{ | ||
$ConfigurationNames = $null | ||
} | ||
else | ||
{ | ||
$ConfigurationNames = @($NodeConfigurationName) | ||
} | ||
|
||
if($ReportOnly) | ||
{ | ||
$RefreshMode = "PUSH" | ||
} | ||
else | ||
{ | ||
$RefreshMode = "PULL" | ||
} | ||
|
||
Node $ComputerName | ||
{ | ||
|
||
Settings | ||
{ | ||
RefreshFrequencyMins = $RefreshFrequencyMins | ||
RefreshMode = $RefreshMode | ||
ConfigurationMode = $ConfigurationMode | ||
AllowModuleOverwrite = $AllowModuleOverwrite | ||
RebootNodeIfNeeded = $RebootNodeIfNeeded | ||
ActionAfterReboot = $ActionAfterReboot | ||
ConfigurationModeFrequencyMins = $ConfigurationModeFrequencyMins | ||
} | ||
|
||
if(!$ReportOnly) | ||
{ | ||
ConfigurationRepositoryWeb AzureAutomationDSC | ||
{ | ||
ServerUrl = $RegistrationUrl | ||
RegistrationKey = $RegistrationKey | ||
ConfigurationNames = $ConfigurationNames | ||
} | ||
|
||
ResourceRepositoryWeb AzureAutomationDSC | ||
{ | ||
ServerUrl = $RegistrationUrl | ||
RegistrationKey = $RegistrationKey | ||
} | ||
} | ||
|
||
ReportServerWeb AzureAutomationDSC | ||
{ | ||
ServerUrl = $RegistrationUrl | ||
RegistrationKey = $RegistrationKey | ||
} | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
...g - Cloudify your Windows File Server/Scripts/DSC/AzureFileSyncAgent/HybridFileServer.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
Configuration HybridFileServer | ||
{ | ||
$FileSyncPackageLocalPath = "C:\Windows\Temp\StorageSyncAgent.msi" | ||
$AzureFileSyncSubscriptionId = Get-AutomationVariable -Name "AzureFileSyncSubscriptionId" | ||
$AzureFileSyncResourceGroup = Get-AutomationVariable -Name "AzureFileSyncResourceGroup" | ||
$AzureFileSyncInstanceName = Get-AutomationVariable -Name "AzureFileSyncInstanceName" | ||
$AzureCredential = Get-AutomationPSCredential -Name "AzureFileSyncNodeRegistration" | ||
|
||
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 $AllNodes.Where{$PSItem.NodeType -eq 'HybridFileServer'}.NodeName { | ||
|
||
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 = $FileSyncPackageLocalPath | ||
} | ||
|
||
Package FileSync { | ||
Ensure = "Present" | ||
Path = $FileSyncPackageLocalPath | ||
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 = $AzureFileSyncSubscriptionId | ||
AzureFileSyncResourceGroup = $AzureFileSyncResourceGroup | ||
AzureFileSyncInstanceName = $AzureFileSyncInstanceName | ||
AzureCredential = $AzureCredential | ||
DependsOn = '[Service]FileSyncService' | ||
|
||
} | ||
|
||
if ($NodeName -like "BranchFS*") { | ||
|
||
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 = $AzureFileSyncSubscriptionId | ||
AzureFileSyncResourceGroup = $AzureFileSyncResourceGroup | ||
AzureFileSyncInstanceName = $AzureFileSyncInstanceName | ||
AzureFileSyncGroup = $node.AzureFileSyncGroup | ||
AzureCredential = $AzureCredential | ||
ServerLocalPath = $Node.AzureFileSyncServerEndpointLocalPath | ||
CloudTiering = $node.AzureFileSyncCloudTiering | ||
TierFilesOlderThanDays = $node.AzureFileSyncTierFilesOlderThanDays | ||
DependsOn = '[File]DirectoryDemoData' | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ndows File Server/Scripts/DSC/AzureFileSyncAgent/HybridFileServer_Configuration_Data.psd1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$ConfigurationData = @{ | ||
AllNodes = @( | ||
@{ | ||
NodeName = '*' | ||
PSDscAllowPlainTextPassword = $true | ||
PSDscAllowDomainUser = $true | ||
NodeType = 'HybridFileServer' | ||
}, | ||
@{ | ||
NodeName = 'BranchFS' | ||
AzureFileSyncGroup = 'NICDemoData' | ||
AzureFileSyncServerEndpointLocalPath = 'D:\NICDemoData' | ||
AzureFileSyncCloudTiering = $true | ||
AzureFileSyncTierFilesOlderThanDays = 365 | ||
}, | ||
@{ | ||
NodeName = 'ClusterFS' | ||
} | ||
) | ||
} |
30 changes: 30 additions & 0 deletions
30
...s File Server/Scripts/DSC/AzureFileSyncServerEndpoint/1 - AzureFileSyncServerEndpoint.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
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 { | ||
|
||
AzureFileSyncServerEndpoint Data { | ||
|
||
AzureSubscriptionId = 'c0fda861-1234-5678-9ede-fa1908101500' | ||
AzureFileSyncResourceGroup = 'File-Sync-Rg' | ||
AzureFileSyncInstanceName = 'FileSync01' | ||
AzureFileSyncGroup = 'FileServers' | ||
AzureCredential = $AzureCredential | ||
ServerLocalPath = 'D:\Data' | ||
CloudTiering = $true | ||
TierFilesOlderThanDays = '365' | ||
|
||
} | ||
|
||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...eFileSyncServerEndpoint/2 - AzureFileSyncAgent - Azure Automation_Configuration_Data.psd1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$ConfigurationData = @{ | ||
AllNodes = @( | ||
@{ | ||
NodeName = '*' | ||
PSDscAllowPlainTextPassword = $true | ||
PSDscAllowDomainUser = $true | ||
NodeType = 'HybridFileServer' | ||
}, | ||
@{ | ||
NodeName = 'BranchFS' | ||
AzureFileSyncGroup = 'DemoData' | ||
AzureFileSyncServerEndpointLocalPath = 'D:\DemoData' | ||
AzureFileSyncCloudTiering = $true | ||
AzureFileSyncTierFilesOlderThanDays = 365 | ||
}, | ||
@{ | ||
NodeName = 'ClusterFS' | ||
} | ||
) | ||
} |
32 changes: 32 additions & 0 deletions
32
...ts/DSC/AzureFileSyncServerEndpoint/2 - AzureFileSyncServerEndpoint - Azure Automation.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Configuration HybridFileServer | ||
{ | ||
$FileSyncPackageLocalPath = "C:\Windows\Temp\StorageSyncAgent.msi" | ||
$AzureFileSyncSubscriptionId = Get-AutomationVariable -Name "AzureFileSyncSubscriptionId" | ||
$AzureFileSyncResourceGroup = Get-AutomationVariable -Name "AzureFileSyncResourceGroup" | ||
$AzureFileSyncInstanceName = Get-AutomationVariable -Name "AzureFileSyncInstanceName" | ||
$AzureCredential = Get-AutomationPSCredential -Name "AzureFileSyncNodeRegistration" | ||
|
||
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 'HybridFileServer' { | ||
|
||
AzureFileSyncServerEndpoint DemoData { | ||
|
||
AzureSubscriptionId = $AzureFileSyncSubscriptionId | ||
AzureFileSyncResourceGroup = $AzureFileSyncResourceGroup | ||
AzureFileSyncInstanceName = $AzureFileSyncInstanceName | ||
AzureFileSyncGroup = $node.AzureFileSyncGroup | ||
AzureCredential = $AzureCredential | ||
ServerLocalPath = $Node.AzureFileSyncServerEndpointLocalPath | ||
CloudTiering = $node.AzureFileSyncCloudTiering | ||
TierFilesOlderThanDays = $node.AzureFileSyncTierFilesOlderThanDays | ||
DependsOn = '[File]DirectoryDemoData' | ||
|
||
} | ||
|
||
} | ||
} |
Binary file added
BIN
+4.36 KB
...ndows File Server/Scripts/Lability/AzureAutomationDscMetaConfiguration/BranchFS2.meta.mof
Binary file not shown.
Binary file added
BIN
+4.36 KB
...our Windows File Server/Scripts/Lability/AzureAutomationDscMetaConfiguration/FS1.meta.mof
Binary file not shown.
Binary file added
BIN
+4.36 KB
...our Windows File Server/Scripts/Lability/AzureAutomationDscMetaConfiguration/FS2.meta.mof
Binary file not shown.
Oops, something went wrong.