Publishing GIS Services via the ArcGIS Module - Esri/arcgis-powershell-dsc GitHub Wiki

The PowerShell DSC ArcGIS Module has a limited capability to publish GIS services to an existing ArcGIS Server site or ArcGIS Enterprise deployment. It can either publish services via a service definition (.sd) file or can create a GIS service in a folder by submitting a JSON representation of the service using the ArcGIS Server Create Service resource.

To publish GIS services, use the Invoke-PublishGISService cmdlet command along with the -ConfigurationParameterFile PublishGISService.json.

Variable definitions for PublishGISService.json

  • ServerNode: The machine name of the target node from which the services will be published. It can be different from the machines in your target deployment (ServerHostName) and/or (PortalHostName).
  • CertificateFile: (Optional) The path to the target node certificate file used for encrypted Managed Object Format (MOF) files.
  • Thumbprint: (Optional) The thumbprint of the target node certificate used for encrypted MOF files.
  • PortalHostName: The Portal for ArcGIS fully qualified domain name (FQDN). This also can be an ArcGIS Web Adaptor or third-party reverse proxy or load balancer FQDN.
  • PortalPort: The port on which Portal for ArcGIS is listening. If using an ArcGIS Web Adaptor or third-party reverse proxy or load balancer, use port 443.
  • PortalContext: The context name of the ArcGIS Portal Web Adaptor. For example, https://portalwebadaptor.domain.com/portal/home the PortalContext would be portal.
  • ServerHostName: The fully qualified domain name of the ArcGIS Server site to which the service will be published.
  • ServerPort: The port on which ArcGIS Server is listening. If using an ArcGIS Web Adaptor or third-party reverse proxy or load balancer, use port 443.
  • ServerContext: The context name of the ArcGIS Server Web Adaptor. For example, https://serverwebadaptor.domain.com/server/rest the ServerContext would be server.
  • PublisherAccountCredential: If publishing to a stand-alone GIS Server site, use GIS Server credentials; otherwise, if publishing to a federated server or hosting server, use ArcGIS Enterprise portal credentials.
    • UserName: The user name of the publisher account.
    • Password: (Conditional) The password for the publisher account.
    • PasswordFile: (Optional) The path to an encrypted file that contains the password for the publisher account. If you provide a password file, you do not have to use the Password parameter above.
  • GISServices
    • Name: The name of the service.
    • Type: The type of service. See Service types for available options.
    • PathToItemInfoFile: A path to a file that can be used to edit the item info.
    • PathToSourceFile: The path to where the *.sd file or JSON file resides.
    • Folder: The folder on the ArcGIS Server site machines to which the service will be published. If the folder does not exist, one will be created.

Example 1: Publish GIS services using a service definition (.sd) file to an existing base ArcGIS Enterprise deployment.

Command: Invoke-PublishGISService -ConfigurationParameterFile PublishGISService.json

PublishGISService.json:

{
    "ServerNode": "server01",
    "ServerHostName": "server01.domain.com",
    "ServerPort": 443,
    "ServerContext": "server",
    "PublisherAccountCredential": {
        "UserName": "portaladmin",
        "Password": "portaladmin"
    },
    "PortalHostName": "server01.domain.com",
    "PortalPort": 443,
    "PortalContext": "portal",
    "GISServices": [
        {
            "Name": "AddressPoints",
            "Type": "MapServer",
            "PathToItemInfoFile": "",
            "PathToSourceFile": "C:\\gis_service_definition_files\\AddressPoints.sd",
            "Folder": "root"
        },
        {
            "Name": "Administrative_Boundaries",
            "Type": "MapServer",
            "PathToItemInfoFile": "",
            "PathToSourceFile": "C:\\gis_service_definition_files\\Administrative_Boundaries.sd",
            "Folder": "root"
        }
    ]
}

Example 2: Publish GIS services using a JSON file to an existing base ArcGIS Enterprise deployment.

Command: Invoke-PublishGISService -ConfigurationParameterFile PublishGISService.json

PublishGISService.json:

{
    "ServerNode": "server01",
    "ServerHostName": "server01.domain.com",
    "ServerPort": 443,
    "ServerContext": "server",
    "PublisherAccountCredential": {
        "UserName": "portaladmin",
        "Password": "portaladmin"
    },
    "PortalHostName": "server01.domain.com",
    "PortalPort": 443,
    "PortalContext": "portal",
    "GISServices": [
        {
            "Name": "Sample World Cities",
            "Type": "MapServer",
            "PathToItemInfoFile": "",
            "PathToSourceFile": "C:\\gis_service_json_files\\SampleWorldCities.json",
            "Folder": "root"
        },
        {
            "Name": "Sample World Cities 2",
            "Type": "MapServer",
            "PathToItemInfoFile": "",
            "PathToSourceFile": "C:\\gis_service_json_files\\SampleWorldCities2.json",
            "Folder": "root"
        }
    ]
}

Example 3: Publish GIS services using a service definition (.sd) file to an existing stand-alone GIS Server site.

Command: Invoke-PublishGISService -ConfigurationParameterFile PublishGISService.json

PublishGISService.json:

{
    "ServerNode": "server01",
    "ServerHostName": "server01.domain.com",
    "ServerPort": 443,
    "ServerContext": "server",
    "PublisherAccountCredential": {
        "UserName": "siteadmin",
        "Password": "siteadmin"
    },
    "GISServices": [
        {
            "Name": "Sample World Cities",
            "Type": "MapServer",
            "PathToItemInfoFile": "",
            "PathToSourceFile": "C:\\gis_service_definition_files\\SampleWorldCities.sd",
            "Folder": "root"
        }
    ]
}