diff --git a/Scenarios/AzSHCI Deployment/Scenario.ps1 b/Scenarios/AzSHCI Deployment/Scenario.ps1 index 88f7823a..857b4d68 100644 --- a/Scenarios/AzSHCI Deployment/Scenario.ps1 +++ b/Scenarios/AzSHCI Deployment/Scenario.ps1 @@ -886,49 +886,6 @@ #endregion -#region Create Volumes to use max capacity. It also depends what mix of devices you have https://github.com/Microsoft/WSLab/tree/master/Scenarios/S2D%20and%20Volumes%20deep%20dive - - #calculate reserve - $pool=Get-StoragePool -CimSession $clustername -FriendlyName s2D* - $HDDCapacity= ($pool |Get-PhysicalDisk -CimSession $clustername | where-object mediatype -eq HDD | Measure-Object -Property Size -Sum).Sum - $HDDMaxSize= ($pool |Get-PhysicalDisk -CimSession $clustername | where-object mediatype -eq HDD | Measure-Object -Property Size -Maximum).Maximum - $SSDCapacity= ($pool |Get-PhysicalDisk -CimSession $clustername | where-object mediatype -eq SSD | where-object usage -ne journal | Measure-Object -Property Size -Sum).Sum - $SSDMaxSize= ($pool |Get-PhysicalDisk -CimSession $clustername | where-object mediatype -eq SSD | where-object usage -ne journal | Measure-Object -Property Size -Maximum).Maximum - - $numberofNodes=(Get-ClusterNode -Cluster $clustername).count - if ($numberofNodes -eq 2){ - if ($SSDCapacity){ - $SSDCapacityToUse=$SSDCapacity-($numberofNodes*$SSDMaxSize)-100GB #100GB just some reserve (16*3 = perfhistory)+some spare capacity - $sizeofvolumeonSSDs=$SSDCapacityToUse/2/$numberofNodes - } - if ($HDDCapacity){ - $HDDCapacityToUse=$HDDCapacity-($numberofNodes*$HDDMaxSize)-100GB #100GB just some reserve (16*3 = perfhistory)+some spare capacity - $sizeofvolumeonHDDs=$HDDCapacityToUse/2/$numberofNodes - } - }else{ - if ($SSDCapacity){ - $SSDCapacityToUse=$SSDCapacity-($numberofNodes*$SSDMaxSize)-100GB #100GB just some reserve (16*3 = perfhistory)+some spare capacity - $sizeofvolumeonSSDs=$SSDCapacityToUse/3/$numberofNodes - } - if ($HDDCapacity){ - $HDDCapacityToUse=$HDDCapacity-($numberofNodes*$HDDMaxSize)-100GB #100GB just some reserve (16*3 = perfhistory)+some spare capacity - $sizeofvolumeonHDDs=$HDDCapacityToUse/3/$numberofNodes - } - } - - #create volumes - 1..$numberofNodes | ForEach-Object { - if ($sizeofvolumeonHDDs){ - New-Volume -CimSession $ClusterName -FileSystem CSVFS_ReFS -StoragePoolFriendlyName S2D* -Size $sizeofvolumeonHDDs -FriendlyName "MyVolumeonHDDs$_" -MediaType HDD - } - if ($sizeofvolumeonSSDs){ - New-Volume -CimSession $ClusterName -FileSystem CSVFS_ReFS -StoragePoolFriendlyName S2D* -Size $sizeofvolumeonSSDs -FriendlyName "MyVolumeonSSDs$_" -MediaType SSD - } - } - - start-sleep 10 -#endregion - #region Register Azure Stack HCI to Azure if ($DellHW){ #Add OEM Information so hardware is correctly billed @@ -1041,7 +998,157 @@ #> #endregion -#region Create some VMs (3 per each CSV disk) https://github.com/Microsoft/WSLab/tree/master/Scenarios/S2D%20and%20Bulk%20VM%20creation +#region Configure thin provisioned volumes as default if available + $OSInfo=Invoke-Command -ComputerName $ClusterName -ScriptBlock { + Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\' + } + if ($OSInfo.productname -eq "Azure Stack HCI" -and $OSInfo.CurrentBuildNumber -ge 20348){ + Get-StoragePool -CimSession $ClusterName -FriendlyName S2D* | Set-StoragePool -ProvisioningTypeDefault Thin + } +#endregion + +#region (optional - just an example) Create Volumes to use max capacity. It also depends what mix of devices you have https://github.com/Microsoft/MSLab/tree/master/Scenarios/S2D%20and%20Volumes%20deep%20dive + + #calculate reserve + $pool=Get-StoragePool -CimSession $clustername -FriendlyName s2D* + $HDDCapacity= ($pool |Get-PhysicalDisk -CimSession $clustername | where-object mediatype -eq HDD | Measure-Object -Property Size -Sum).Sum + $HDDMaxSize= ($pool |Get-PhysicalDisk -CimSession $clustername | where-object mediatype -eq HDD | Measure-Object -Property Size -Maximum).Maximum + $SSDCapacity= ($pool |Get-PhysicalDisk -CimSession $clustername | where-object mediatype -eq SSD | where-object usage -ne journal | Measure-Object -Property Size -Sum).Sum + $SSDMaxSize= ($pool |Get-PhysicalDisk -CimSession $clustername | where-object mediatype -eq SSD | where-object usage -ne journal | Measure-Object -Property Size -Maximum).Maximum + + $numberofNodes=(Get-ClusterNode -Cluster $clustername).count + if ($numberofNodes -eq 2){ + if ($SSDCapacity){ + $SSDCapacityToUse=$SSDCapacity-($numberofNodes*$SSDMaxSize)-100GB #100GB just some reserve (16*3 = perfhistory)+some spare capacity + $sizeofvolumeonSSDs=$SSDCapacityToUse/2/$numberofNodes + } + if ($HDDCapacity){ + $HDDCapacityToUse=$HDDCapacity-($numberofNodes*$HDDMaxSize)-100GB #100GB just some reserve (16*3 = perfhistory)+some spare capacity + $sizeofvolumeonHDDs=$HDDCapacityToUse/2/$numberofNodes + } + }else{ + if ($SSDCapacity){ + $SSDCapacityToUse=$SSDCapacity-($numberofNodes*$SSDMaxSize)-100GB #100GB just some reserve (16*3 = perfhistory)+some spare capacity + $sizeofvolumeonSSDs=$SSDCapacityToUse/3/$numberofNodes + } + if ($HDDCapacity){ + $HDDCapacityToUse=$HDDCapacity-($numberofNodes*$HDDMaxSize)-100GB #100GB just some reserve (16*3 = perfhistory)+some spare capacity + $sizeofvolumeonHDDs=$HDDCapacityToUse/3/$numberofNodes + } + } + + #create volumes + 1..$numberofNodes | ForEach-Object { + if ($sizeofvolumeonHDDs){ + New-Volume -CimSession $ClusterName -FileSystem CSVFS_ReFS -StoragePoolFriendlyName S2D* -Size $sizeofvolumeonHDDs -FriendlyName "MyVolumeonHDDs$_" -MediaType HDD + } + if ($sizeofvolumeonSSDs){ + New-Volume -CimSession $ClusterName -FileSystem CSVFS_ReFS -StoragePoolFriendlyName S2D* -Size $sizeofvolumeonSSDs -FriendlyName "MyVolumeonSSDs$_" -MediaType SSD + } + } + + start-sleep 10 +#endregion + +#region (optional) register your Dell partner ID to your Azure Subscription https://docs.microsoft.com/en-us/partner-center/link-partner-id-for-azure-performance-pal-dpor +if ($DellHW){ + #define list of Location PAL IDs + $CSV=@" + Argentina;1973856 + Australia;1576776 + Austria;1444496 + Belgium;1447258 + Brazil;1563635 + Canada;742767 + Chile;2389235 + China;2580218 + Colombia;1736279 + Czech Republic;1980606 + Denmark;1449600 + Egypt;6462248 + Finland;1993462 + France;892181 + Germany;1449416 + Greece;3679221 + Hong Kong Sar;2790298 + India;2419713 + Indonesia;2834572 + Ireland;1447272 + Israel;6462253 + Italy;1446223 + Japan;578508 + Korea;2153293 + Luxembourg;6462292 + Malaysia;2731874 + Mexico;724848 + Morocco;6462283 + Netherlands;1446198 + New Zealand;1872429 + Norway;1446238 + Pakistan;6462648 + Panama;1477223 + Peru;6466758 + Poland;3697305 + Portugal;1552205 + Romania;1735552 + Russia;4543982 + Singapore;2773797 + Slovakia;3812320 + South Africa;1970176 + Spain;1004323 + Sweden;1449417 + Switzerland;1449592 + Taiwan;5097219 + Thailand;2345177 + Turkey;3396579 + United Arab Emirates;3159758 + United Kingdom;1447267 + United States;913990 +"@ + $Header = 'Country', 'LocationID' + $PALIDs=ConvertFrom-Csv -Delimiter ";" -InputObject $CSV -Header $Header + + #Install Azure packages + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force + $ModuleNames="Az.Accounts","Az.Resources","Az.ManagementPartner" + foreach ($ModuleName in $ModuleNames){ + if (!(Get-InstalledModule -Name $ModuleName -ErrorAction Ignore)){ + Install-Module -Name $ModuleName -Force + } + } + + #login to Azure (if not logged in already) + if (-not (Get-AzContext)){ + Login-AzAccount -UseDeviceAuthentication + } + + $RegistrationInfo=Get-AzManagementPartner -ErrorAction Ignore + <# + if ($RegistrationInfo -eq $null){ + Write-Host "Partner registration not found" -ForegroundColor Red + }else{ + Write-Host "Following partner registration found:" -ForegroundColor Green + $RegistrationInfo + } + #> + + #Select location + $LocationID=$PALIDs | Out-GridView -Title "Please select location ID" -OutputMode Single + + #register new partner + if ($RegistrationInfo){ + Update-AzManagementPartner -PartnerId $LocationID.LocationID + }else{ + New-AzManagementPartner -PartnerId $LocationID.LocationID + } + + #remove + #$RegistrationInfo=Get-AzManagementPartner + #Remove-AzManagementPartner -PartnerID $RegistrationInfo.PartnerID +} +#endregion + +#region (optional - just an example) Create some VMs (3 per each CSV disk) https://github.com/Microsoft/WSLab/tree/master/Scenarios/S2D%20and%20Bulk%20VM%20creation Start-Sleep -Seconds 60 #just to a bit wait as I saw sometimes that first VMs fails to create if ($realVMs -and $VHDPath){ $CSVs=(Get-ClusterSharedVolume -Cluster $ClusterName).Name diff --git a/Scenarios/AzSHCI and AVD/Scenario.ps1 b/Scenarios/AzSHCI and AVD/Scenario.ps1 index 40e7affa..e2a20294 100644 --- a/Scenarios/AzSHCI and AVD/Scenario.ps1 +++ b/Scenarios/AzSHCI and AVD/Scenario.ps1 @@ -46,7 +46,10 @@ $WorkspaceName="MSLabAVDWorkspace-$SubscriptionID" $WorkspaceResourceGroupName=$AVDResourceGroupName $WorkspaceLocation=$HostPoolLocation + + #automation account $AutomationAccountName="MSLabLabAVDAutomationAccount" + $AutomationAccountLocation=$HostPoolLocation=(Get-AzLocation | Where-Object Providers -Contains "Microsoft.Automation" | Where-Object Location -ne $WorkspaceLocation | Out-GridView -OutputMode Single -Title "Please select Location for Automation Accout (Canot be $WorkspaceLocation").Location #Define ARC Agents $ARCResourceGroupName=$AVDResourceGroupName @@ -296,7 +299,7 @@ } #endregion -#region install and register Azure Arc agent +#region install and register Azure Arc agent (optional for log analytics and update management) #install connected machine agent (Azure Arc) = See Azure Arc for servers scenario https://github.com/microsoft/MSLab/tree/master/Scenarios/Azure%20Arc%20for%20Servers # Download the package Start-BitsTransfer -Source https://aka.ms/AzureConnectedMachineAgent -Destination "$env:UserProfile\Downloads\AzureConnectedMachineAgent.msi" @@ -460,7 +463,7 @@ #> #endregion -#region setup AVD Monitoring https://docs.microsoft.com/en-us/azure/virtual-desktop/azure-monitor?WT.mc_id=Portal-AppInsightsExtension +#region setup AVD Monitoring (Arc Agent needed, not supported yet) https://docs.microsoft.com/en-us/azure/virtual-desktop/azure-monitor?WT.mc_id=Portal-AppInsightsExtension #region Create log analytics workspace and grab workspace key if (-not(Get-AzResourceGroup -Name $WorkspaceResourceGroupName -ErrorAction SilentlyContinue)){ @@ -473,7 +476,7 @@ $Workspacekey=($Workspace | Get-AzOperationalInsightsWorkspaceSharedKey).PrimarySharedKey #endregion - #region Configure diagnostic settings for the host pool + #region Configure diagnostic settings for the AVD host pool $json=@' { "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", @@ -1210,7 +1213,7 @@ #endregion #region setup Azure Update (add Automation account) - New-AzAutomationAccount -Name $AutomationAccountName -ResourceGroupName $WorkspaceResourceGroupName -Location $WorkspaceLocation -Plan Free + New-AzAutomationAccount -Name $AutomationAccountName -ResourceGroupName $WorkspaceResourceGroupName -Location $AutomationAccountLocation -Plan Free #link workspace to Automation Account (via an ARM template deployment) $json = @" @@ -1465,6 +1468,68 @@ #endregion +#region configure app attach (Optional, based (a bit) on https://github.com/microsoft/MSLab/tree/master/Scenarios/AppAttach) + #Install Hyper-V platform to be able to work with tools and restart + Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V -Online + + #setup file share + $FileServerName="FileServer" + $FolderName="AppAttach" + Invoke-Command -ComputerName $FileServerName -ScriptBlock {new-item -Path D:\Shares -Name $using:FolderName -ItemType Directory} + $accounts=@() + $accounts+="corp\Domain Computers" + $accounts+="corp\Domain Users" + New-SmbShare -Name $FolderName -Path "D:\Shares\$FolderName" -ReadAccess $accounts -CimSession $FileServerName + #Set NTFS permissions + Invoke-Command -ComputerName $$FileServerName -ScriptBlock {(Get-SmbShare $using:FolderName).PresetPathAcl | Set-Acl} + + #Download MSIX Package + if (!(Test-Path "$env:USERPROFILE\Downloads\msixmgr\x64\msixmgr.exe")){ + Invoke-WebRequest -Uri https://aka.ms/msixmgr -OutFile "$env:USERPROFILE\Downloads\msixmgr.zip" + Expand-Archive -Path "$env:USERPROFILE\Downloads\msixmgr.zip" -DestinationPath "$env:USERPROFILE\Downloads\msixmgr" + } + + #login to azure (if not) + if (-not (Get-AzContext)){ + Login-AzAccount -UseDeviceAuthentication + } + + #grab host pool + $Hostpool=Get-AzWvdHostPool + If ($Hostpool.Count -gt 1){ + $Hostpool=$Hostpool | Out-GridView -Title "Please Select Hostpool" -OutputMode Single + } + $hp=$HostPool.Name + $rg=($Hostpool.ID).Split("/") | Select-Object -Index 4 + $subId=($Hostpool.ID).Split("/") | Select-Object -Index 2 + #define example msix (or more) + $Files=@() + $Files+=@{URL="https://github.com/PowerShell/PowerShell/releases/download/v7.0.2/PowerShell-7.0.2-win-x64.msix"; FileName="PowerShell-7.0.2-win-x64.msix"; AppName="PowerShell7"} + + foreach($file in $Files){ + #Download + Start-BitsTransfer -Source $File.URL -Destination "$env:USERPROFILE\Downloads\$($File.FileName)" + + #Copy MSIX to VHD + #create vhd + $vhd=New-VHD -SizeBytes 100GB -path $env:USERPROFILE\Downloads\$($File.AppName).vhdx -dynamic -confirm:$false + #mount and format VHD + $VHDMount=Mount-VHD $vhd.Path -Passthru + $vhddisk = $vhdmount | Get-Disk + $vhddiskpart = $vhddisk | Initialize-Disk -PartitionStyle GPT -PassThru | New-Partition -UseMaximumSize -AssignDriveLetter | Format-Volume -Filesystem NTFS -AllocationUnitSize 8kb -NewFileSystemLabel $appname + #add MSIX + Start-Process -FilePath "$env:USERPROFILE\Downloads\msixmgr\x64\msixmgr.exe" -ArgumentList "-Unpack -packagePath `"$env:USERPROFILE\Downloads\$($File.FileName)`" -destination $($vhddiskpart.driveletter):\Packages -applyacls" -Wait + Dismount-VHD $vhddisk.number + #Copy app to FileShare + Copy-Item -Path "$env:USERPROFILE\Downloads\$($File.AppName).VHDX" -Destination "\\$FileServerName\d$\Shares\$FolderName" + #setup msix https://docs.microsoft.com/en-us/azure/virtual-desktop/app-attach-powershell + $obj = Expand-AzWvdMsixImage -HostPoolName $hp -ResourceGroupName $rg -SubscriptionID $subId -Uri \\$FileServerName\$FolderName\$($File.AppName).vhdx + New-AzWvdMsixPackage -HostPoolName $hp -ResourceGroupName $rg -SubscriptionId $subId -PackageAlias $obj.PackageAlias -DisplayName $File.AppName -ImagePath \\$FileServerName\$FolderName\$($File.AppName).vhdx -IsActive:$true + #validate app + Get-AzWvdMsixPackage -HostPoolName $hp -ResourceGroupName $rg -SubscriptionId $subId | Where-Object {$_.PackageFamilyName -eq $obj.PackageFamilyName} + } +#endregion + #region configure AD Connect, assign users (manual task) #Login to DC, Download AD Connect and install. #ADConnect diff --git a/Scenarios/AzSHCI and Arc-enabled VMs/Scenario.ps1 b/Scenarios/AzSHCI and Arc-enabled VMs/Scenario.ps1 index 8ac446cb..58e1477d 100644 --- a/Scenarios/AzSHCI and Arc-enabled VMs/Scenario.ps1 +++ b/Scenarios/AzSHCI and Arc-enabled VMs/Scenario.ps1 @@ -317,7 +317,7 @@ #create arc appliance #generate config files Invoke-Command -ComputerName $ClusterName -ScriptBlock { - New-ArcHciConfigFiles -subscriptionID $using:HCISubscriptionID -location $using:location -resourceGroup $using:HCIResourceGroupName -resourceName $using:BridgeResourceName -workDirectory "\\$using:ClusterName\ClusterStorage$\$using:VolumeName\workingDir" + New-ArcHciConfigFiles -subscriptionID $using:HCISubscriptionID -location $using:ArcResourceBridgeLocation -resourceGroup $using:HCIResourceGroupName -resourceName $using:BridgeResourceName -workDirectory "\\$using:ClusterName\ClusterStorage$\$using:VolumeName\workingDir" } #prepare az arcappliance prepare hci --config-file \\$ClusterName\ClusterStorage$\$VolumeName\workingDir\hci-appliance.yaml diff --git a/Scenarios/S2D Hyperconverged/Scenario.ps1 b/Scenarios/S2D Hyperconverged/Scenario.ps1 index 59c30e4f..1e10eea7 100644 --- a/Scenarios/S2D Hyperconverged/Scenario.ps1 +++ b/Scenarios/S2D Hyperconverged/Scenario.ps1 @@ -2,6 +2,8 @@ # Run from DC or Management VM # ################################ +#note: this scenario is bit obsolete, use https://github.com/microsoft/MSLab/tree/master/Scenarios/AzSHCI%20Deployment instead + $StartDateTime = get-date Write-host "Script started at $StartDateTime" diff --git a/Scenarios/S2D Hyperconverged/readme.md b/Scenarios/S2D Hyperconverged/readme.md index 7b04d0cd..3b266784 100644 --- a/Scenarios/S2D Hyperconverged/readme.md +++ b/Scenarios/S2D Hyperconverged/readme.md @@ -11,6 +11,8 @@ # Scenario Description +> Note: Scenario is bit obsolete. Use [AzSHCI Deployment Scenario](https://github.com/microsoft/MSLab/tree/master/Scenarios/AzSHCI%20Deployment) for deployment instead (just skip Azure Registration) + * In this scenario 2-16 node S2D cluster can be created. * It is just simulation "how it would look like". Performance is not a subject here - it is just to test look and feel * Script is well tested, on both real and simulated environments. However if you need assist, ask your Premier Field Engineer