Skip to content
This repository has been archived by the owner on Mar 20, 2020. It is now read-only.

dsc bootstrapping in azure

Peter Burkholder (@pburkholder) edited this page Sep 27, 2016 · 6 revisions

Creating two new nodes with https://github.com/18F/azure-sandbox/blob/pdb/installers/dsc/vms/Two-NewSQLNodes.ps1

Trying to automate 18faz-sql1 with https://azure.microsoft.com/en-us/documentation/articles/automation-dsc-onboarding/

In the Azure portal, click Browse -> Virtual machines (classic). Select the Windows VM you want to onboard. On the virtual machine’s dashboard blade, click All settings -> Extensions -> Add -> Azure Automation DSC -> Create.

In that tile, need to add Registration URL, Registration Key, Request ID. The values for the first two are avilable in Portal -> Azure Automation account - user18faz -> Manage Keys (or the Key icon). The RequestID: Any value can be used, must be uniq every time you register a node. Using 18faz-sql1-20160926

I think the name is 'AzureAutomationDSC' but I don't see it listed when running Get-AzureVMAvailableExtension.

From here, I still need to

  • get install media to the target node
  • get the additional DSC modules to the target node

Options:

Notes about using DSC w/ Azure

  • One gotcha is that the target node is going to need to get remote resources.
  • So one way of doing that is mount some Azure FileStore as a UNC share on the workstation computer, and copying all of "C:\Program Files\WindowsPowerShell\modules" to I:\psmodules (and thence to the target machines)
    • Likewise for the install media
  • It turns out that the target node does not need any Azure Powershell modules installed, it just needs to run:
net use i: \\18fazsandbox2.file.core.windows.net\install  $using:StorageKey /user:18fazsandbox2 /persistent:yes
  • Logging in via Enter-PSSession will not see the net install, but it's there for DSC use
  • The use of cmdkey to persist credentials for net use did not work for me, the output of net use /list on the target machine was always empty.

Stuck DSC Runs

This tip from the book Learning Powershell DSC:

Remove-Item $env:systemRoot/system32/configuration/pending.mof -Force;
Get-Process *wmi* | Stop-Process -Force;
Restart-Service winrm -Force 

Supposedly not needed in WMF5.

also: to remove certs:

Get-ChildItem Cert:/LocalMachine/Root | Where {$_.Subject -eq "CN=18faz-sql1.cloudapp.net"} | Remove-Item