Add a Configuration

Before you can upload a configuration to config.XO you need to write one on your authoring machine. You can find the prerequisites and tools here

For this example we assume you want to upload this little configuration:

Configuration WebsiteTest {

    # Import the module that contains the resources we're using.
    Import-DscResource -ModuleName PsDesiredStateConfiguration

    # The Node statement specifies which targets this configuration will be applied to.
    Node 'localhost' {

        # The first resource block ensures that the Web-Server (IIS) feature is enabled.
        WindowsFeature WebServer {
            Ensure = "Present"
            Name   = "Web-Server"
        }

        # The second resource block ensures that the website content copied to the website root folder.
        File WebsiteContent {
            Ensure = 'Present'
            SourcePath = 'c:\test\index.htm'
            DestinationPath = 'c:\inetpub\wwwroot'
        }
    }
}

Another important part of the configuration is the backend configuration for the XOSS frontend. Be sure to add the following lines to your configuration.

    Import-DSCResource -ModuleName "XOSSBaselineModuleDSC"

and

        XOSSPackageInstaller "Install Applications"
        {
            Id = [GUID]::NewGuid()
            PackageManagementUrl = "https://dk4twwjnrc.execute-api.eu-central-1.amazonaws.com/api/packages"
            ConfigurationManagementUrl = "https://dk4twwjnrc.execute-api.eu-central-1.amazonaws.com/api/dsc"
        }

        XOSSMonitor "Monitoring"
        {
            Url = "https://dk4twwjnrc.execute-api.eu-central-1.amazonaws.com/api/dsc/"
        }

Be sure to adjust the PackageManagementUrl, ConfigurationManagementUrl and the Url for the Monitoring according your custom account URLs.

You can find these URLs in the Application Management and Configuration Management Dashboards. These are unique per account.

Open Visual Studio Code and paste the code from above into a new document. Save it locally as WebSiteTest.ps1.

Code

Be also sure to add the baseline functions to every of your configurations you are uploading.

Not adding the following resources to your configuration will result in not functioning reporting and application installations when using application.XO

Add these resources and adjust them with your custom URLs:

The PackagemanagementUrl is a unique URL for your account. You can find the URL on the application.XO dashbaord.

The ConfigurationManagementUrl is a unique URL for your account. You can find the URL in the config.XO dashboard.

# Resource for application installation via Application Management
XOSSPackageInstaller "Install Applications"
{
    InstallationScope = "Host"
    # generated GUID with PowerShell: [GUID]::NewGuid()
    Id = "50b1f053-a891-406b-8bf0-50b2a188e64d"
    # URL for the Application Management API
    PackageManagementUrl = "https://dk4twwjnrc.execute-api.eu-central-1.amazonaws.com/api/packages"
    # URL for the Configuration Management API
    ConfigurationManagementUrl = "https://dk4twwjnrc.execute-api.eu-central-1.amazonaws.com/api/dsc"
}

# Resource for Reporting 
XOSSMonitor "Monitoring"
{
    # URL for the Frontend Monitoring (Nodes) API
    Url = "https://dk4twwjnrc.execute-api.eu-central-1.amazonaws.com/api/dsc/"
}

The example configuration from above should now look like this:

Configuration WebsiteTest {

    # Import the module that contains the resources we're using.
    Import-DscResource -ModuleName PsDesiredStateConfiguration

    # The Node statement specifies which targets this configuration will be applied to.
    Node 'localhost' {

        # The first resource block ensures that the Web-Server (IIS) feature is enabled.
        WindowsFeature WebServer {
            Ensure = "Present"
            Name   = "Web-Server"
        }

        # The second resource block ensures that the website content copied to the website root folder.
        File WebsiteContent {
            Ensure = 'Present'
            SourcePath = 'c:\test\index.htm'
            DestinationPath = 'c:\inetpub\wwwroot'
        }

        # Resource for application installation via Application Management
        XOSSPackageInstaller "Install Applications"
        {
            InstallationScope = "Host"
            # generated GUID with PowerShell: [GUID]::NewGuid()
            Id = "50b1f053-a891-406b-8bf0-50b2a188e64d"
            # URL for the Application Management API
            PackageManagementUrl = "https://dk4twwjnrc.execute-api.eu-central-1.amazonaws.com/api/packages"
            # URL for the Configuration Management API
            ConfigurationManagementUrl = "https://dk4twwjnrc.execute-api.eu-central-1.amazonaws.com/api/dsc"
        }
        
        # Resource for Reporting 
        XOSSMonitor "Monitoring"
        {
            # URL for the Frontend Monitoring (Nodes) API
            Url = "https://dk4twwjnrc.execute-api.eu-central-1.amazonaws.com/api/dsc/"
        }
    }
}

Now switch to the configurations area in config.XO and hit the Add Configuration button. A new window opens.

Code

Choose the created file and assign a tag to the configuration if you want to.

Code

Click Save.

You can check status of the upload process by clicking on Upload Status.

Code

SUCCEEDED at the end of the log file states a successful upload and compilation of the configuration.

You should now see the configuration in the Configurations area.