PowerShell / PowerShell/PowerShell-RFC

RFC: Extract DSC from Existing Environments

Open
#146 5 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
467
Forks
140
Avg merge
9m
Merged PRs (30d)
1

Description

--
RFC: RFC00xx
Author: Nik Charlebois

Reverse Engineering Existing Environment into DSC

Users have been complaining about the learning curve to get started with DSC and about the amount of work it takes for them to re-write their existing technology investment onto DSC for monitoring purposes. There have been various community projects to solve this issue by extracting DSC configurations out of existing environments, such as ReverseDSC, which had incredible success with clients wanting to adopt Configuration as Code practices within their organizations.

The purpose of this RFC is to propose that a fourth method that would retrieve all instances of a resource against an existing environment be included in DSC resources for them to be identified as HQRM.

Motivation

  • Reduce amount of work required to on-board existing environments onto DSC
  • Reduce learning curve to get started with DSC
  • Provide an automated path to migrate on-premises environments onto Azure
  • Allow users to easily document their environment’s configuration as code
  • Quickly compare configuration deltas between two environments

Specifications

There are three components to the requested solution:

  • Component 1 needs to iterate through all instances of the current resource and provide the Get-TargetResource function the key parameters for it to be able to retrieve all other parameters associated with this resource instance.
  • Component 2 needs to retrieve the Hash tables received back from the Get-TargetResource and convert them into a DSC string. This is already automated and handled by the existing ReverseDSC Core module https://github.com/microsoft/reversedsc
  • Component 3 needs to orchestrate the calls to the resources’ Component 1 and 2 and collect the results into a resulting file, which will be a DSC script that can be used to replicate the environment.

The vision is as follow:
Component 1 and 2 would be combined into a new fourth function required by every HQRM, call it Export-TargetResource. Component 3 would be a global utility module, contained within the DSC module, which would orchestrate all the calls to the module’s Export-TargetResource methods (see SharePointDSC.Reverse at https://github.com/microsoft/sharepointdsc.reverse for a reference)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the RFC's Specifications section and review the referenced ReverseDSC Core module and SharePointDSC.Reverse project. Trace how Get-TargetResource currently retrieves resource instances and how the proposed Export-TargetResource would coordinate with the global utility module. Done means producing a reviewed design for extracting existing environments into reusable DSC scripts.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cloud, devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.