> For the complete documentation index, see [llms.txt](https://docs.lithnet.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lithnet.io/resource-management-powershell/configuration/configuration-management.md).

# Configuration management

The PowerShell module has its own built-in support for configuration management and control within the FIM service. Using an XML file, you can define how resources should appear in the FIM service, and use the \[\[Import-RMConfig]] cmdlet to create, update, and delete resources and attributes as appropriate. The module also supports the use of variables and placeholders to make transitioning configuration between environments as seamless as possible.

Ike Ugochuku has produced [a getting started guide](https://tlktechidentitythoughts.wordpress.com/2016/06/25/vblog-introduction-to-lithnet-rm-config/) to introduce you to configuration management and \[\[Import-RMConfig]].

### XML File Reference

* [ConfigSync file](/resource-management-powershell/configuration/configsync-file.md)
* [Variables element](/resource-management-powershell/configuration/variables-file/variables-element.md)
  * [Variable element](/resource-management-powershell/configuration/variables-file/variables-element/variable-element.md)
* [Operations element](/resource-management-powershell/configuration/operations-element.md)
  * [ResourceOperation element](/resource-management-powershell/configuration/operations-element/resourceoperation-element.md)
  * [AnchorAttributes element](/resource-management-powershell/configuration/operations-element/anchorattributes-element.md)
  * [AnchorAttribute element](/resource-management-powershell/configuration/operations-element/anchorattribute-element.md)
  * [AttributeOperations element](/resource-management-powershell/configuration/operations-element/attributeoperations-element.md)
    * [AttributeOperation element](/resource-management-powershell/configuration/operations-element/attributeoperations-element/attributeoperation-element.md)
* [Variables File](/resource-management-powershell/configuration/variables-file.md)
* [Variable element](/resource-management-powershell/configuration/variables-file/variables-element/variable-element.md)

### Referencing within the XML file

The XML file structure allows you to not only reference objects in the FIM Service, but also to reference other resources described in XML. This can ensure referential integrity and maintain relationships between objects that may or may not have been created in the FIM service. See the topic on \[\[Building References]] for more information

### Sample XML file

The following demonstrates how to describe a set, workflow and MPR in an XML file that can be applied using the [Import-RMConfig](/resource-management-powershell/usage/cmdlet-reference/import-rmconfig.md) cmdlet.

```xml
<?xml version="1.0" encoding="utf-8" ?>
<Lithnet.ResourceManagement.ConfigSync>
  <Variables>
    <Variable name="#domain#" value="%userdomain%"/>
    <Variable name="#PATH#" value =".\" />
  </Variables>
  
  <Operations>
    <!-- Create Set -->
    <ResourceOperation operation="Add Update" resourceType="Set" id="demoSet">
      <AnchorAttributes>
        <AnchorAttribute>DisplayName</AnchorAttribute>
      </AnchorAttributes>
      <AttributeOperations>
        <AttributeOperation operation="replace" name="DisplayName">___Demo Set</AttributeOperation>
        <AttributeOperation operation="replace" name="Description">Contains all the test users for the purpose of this demo</AttributeOperation>
        <AttributeOperation operation="replace" name="Filter" type="filter">/Person[starts-with(AccountName, 'testuser')]</AttributeOperation>
      </AttributeOperations>
    </ResourceOperation>
	
  <!-- Create Email Template -->
  <ResourceOperation operation="Add Update" resourceType="EmailTemplate" id="demoEmailTemplate">
      <AnchorAttributes>
        <AnchorAttribute>DisplayName</AnchorAttribute>
      </AnchorAttributes>
      <AttributeOperations>
        <AttributeOperation operation="replace" name="DisplayName">___Demo Email Template</AttributeOperation>
        <AttributeOperation operation="replace" name="Description">An email template created for the purpose of this demo</AttributeOperation>
        <AttributeOperation operation="replace" name="EmailTemplateType">Notification</AttributeOperation>
        <AttributeOperation operation="replace" name="EmailBody" type="file">#PATH#Templates\EmailTemplate.html</AttributeOperation>
        <AttributeOperation operation="replace" name="EmailSubject">Hello FIM user group</AttributeOperation>
      </AttributeOperations>
    </ResourceOperation>
	
  <!-- Create Workflow Definition -->
  <ResourceOperation operation="Add Update" resourceType="WorkflowDefinition" id="demoWorkflowDefinition">
      <AnchorAttributes>
        <AnchorAttribute>DisplayName</AnchorAttribute>
      </AnchorAttributes>
      <AttributeOperations>
        <AttributeOperation operation="replace" name="DisplayName">___Demo Workflow Definition</AttributeOperation>
        <AttributeOperation operation="replace" name="Description">Sends an account expiry notification email to users email address2</AttributeOperation>
        <AttributeOperation operation="replace" name="XOML" type="file">#PATH#Templates\WFDemo.xml</AttributeOperation>
        <AttributeOperation operation="replace" name="RequestPhase">Action</AttributeOperation>
        <AttributeOperation operation="replace" name="RunOnPolicyUpdate">false</AttributeOperation>
      </AttributeOperations>
    </ResourceOperation>
	
  <!-- Create MPR -->
  <ResourceOperation operation="Add Update" resourceType="ManagementPolicyRule" id="demoMPR">
      <AnchorAttributes>
        <AnchorAttribute>DisplayName</AnchorAttribute>
      </AnchorAttributes>
      <AttributeOperations>
        <AttributeOperation operation="replace" name="DisplayName">___Demo MPR - Triggers Workflow</AttributeOperation>
        <AttributeOperation operation="replace" name="Description">Triggers the "##xmlref:demoWorkflowDefinition:DisplayName##" workflow when a user account transitions into the "##xmlref:demoSet:DisplayName##" set</AttributeOperation>
        <AttributeOperation operation="replace" name="ActionParameter">*</AttributeOperation>
        <AttributeOperation operation="replace" name="ActionType">TransitionIn</AttributeOperation>
        <AttributeOperation operation="replace" name="ActionWorkflowDefinition" type="xmlref">demoWorkflowDefinition</AttributeOperation>
        <AttributeOperation operation="replace" name="Disabled">false</AttributeOperation>
        <AttributeOperation operation="replace" name="GrantRight">false</AttributeOperation>
        <AttributeOperation operation="replace" name="ManagementPolicyRuleType">SetTransition</AttributeOperation>
        <AttributeOperation operation="replace" name="ResourceFinalSet" type="xmlref">demoSet</AttributeOperation>
      </AttributeOperations>
    </ResourceOperation>
  </Operations>
</Lithnet.ResourceManagement.ConfigSync>
```

### Default XSD Schema

The following is the complete XSD schema that can be used for validating a ResourceManagement Configuration file. Thanks to Thomas Weyermann for documenting this.

```xml
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Lithnet.ResourceManagement.ConfigSync">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Variables" type="xs:string" />
        <xs:element name="Operations">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="ResourceOperation">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="AnchorAttributes">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="AnchorAttribute" type="xs:string" />
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="AttributeOperations">
                      <xs:complexType mixed="true">
                        <xs:sequence>
                          <xs:element maxOccurs="unbounded" name="AttributeOperation">
                            <xs:complexType>
                              <xs:simpleContent>
                                <xs:extension base="xs:string">
                                  <xs:attribute name="operation" use="required">
                                    <xs:simpleType>
                                      <xs:restriction base="xs:string">
                                        <xs:enumeration value="none"/>
                                        <xs:enumeration value="add"/>
                                        <xs:enumeration value="replace"/>
                                        <xs:enumeration value="delete"/>
                                      </xs:restriction>
                                    </xs:simpleType>
                                  </xs:attribute>
                                  <xs:attribute name="name" type="xs:string" use="required" />
                                  <xs:attribute name="type" use="optional">
                                    <xs:simpleType>
                                      <xs:restriction base="xs:string">
                                        <xs:enumeration value="file"/>
                                        <xs:enumeration value="xmlref"/>
                                        <xs:enumeration value="filter"/>
                                        <xs:enumeration value="ref"/>
                                      </xs:restriction>
                                    </xs:simpleType>
                                  </xs:attribute>
                                </xs:extension>
                              </xs:simpleContent>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute name="operation" use="required">
                    <xs:simpleType>
                      <xs:restriction base="xs:string">                        
                        <xs:enumeration value="Add"/>
                        <xs:enumeration value="Add Update"/>
                        <xs:enumeration value="Delete"/>
                        <xs:enumeration value="Update"/>
                        <xs:enumeration value="None"/>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="resourceType" type="xs:string" use="required" />
                  <xs:attribute name="id" type="xs:string" use="required" />
                  <xs:attribute name="refresh-schema" use="optional" >
                    <xs:simpleType>
                      <xs:restriction base="xs:string">
                        <xs:enumeration value="before-operation"/>
                        <xs:enumeration value="after-operation"/>
                      </xs:restriction>
                    </xs:simpleType>
                  </xs:attribute>
                  <xs:attribute name="locale" type="xs:string" use="optional" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
          <xs:unique name="idUniqueKey">
            <xs:selector xpath="ResourceOperation" />
            <xs:field xpath="@id" />
          </xs:unique>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.lithnet.io/resource-management-powershell/configuration/configuration-management.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
