Esri / arcgis-powershell-dsc

This repository contains scripts, code and samples for automating the install and configuration of ArcGIS (Enterprise and Desktop) using Microsoft Windows PowerShell DSC (Desired State Configuration).
Apache License 2.0
120 stars 62 forks source link

Documentation: Portal Content directory must exist, it will not be created #518

Closed mjperez-usgs closed 4 months ago

mjperez-usgs commented 10 months ago

Community Note

Module Version

4.2.0

Affected Resource(s)

Configuration Files

{
    "AllNodes": [
        {
            "NodeName": "Svr1.email.com",
            "Role": [
                "Portal",
                "DataStore",
                "WebAdaptor"
            ],
            "DataStoreTypes": [
                "Relational"
            ],
            "SslCertificates": [
                {
                    "Path": "C:\\AWSSetup\\Cert.pfx",
                    "Password": "certPassword",
                    "CNameFQDN": "Svr1.email.com",
                    "Target": [
                        "Portal",
                        "WebAdaptor",
                        "DataStore"
                    ]
                }
            ],
            "WebAdaptorConfig":[
                {
                    "Role": "Portal",
                    "Context": "portal",
                    "WebSiteId": 1
                }
            ]
        }
    ],
    "ConfigData": {
        "Version": "11.2",
        "ServerContext": "server",
        "PortalContext": "portal",
        "ServerRole": "GeneralPurposeServer",
        "DownloadSetups": false,
        "DownloadPatches": false,
        "Credentials": {
            "ServiceAccount": {
                "UserName": "email\\svcAccount",
                "Password": "adPass",
                "IsDomainAccount": true,
                "IsMSAAccount": false
            },
            "ADServiceUser": {
                "UserName": "email\\svcAccount",
                "Password": "adPass"
            }
        },
        "DataStore": {
            "ContentDirectoryLocation": "\\\\server.email.com\\share\\PROJECT\\ArcGISDataStore",
            "EnableFailoverOnPrimaryStop": false,
            "EnablePointInTimeRecovery": false,
            "Installer": {
                "Path": "C:\\AWSSetup\\ArcGIS_DataStore_Windows_112_188252.exe",
                "InstallDir": "C:\\ArcGIS\\DataStore",
                "InstallAllFeatures": false
            }
        },
        "Portal": {
            "LicenseFilePath": "C:\\AWSSetup\\portal_112.json",
            "PortalLicenseUserTypeId": "creatorUT",
            "Installer": {
                "Path": "C:\\AWSSetup\\Portal_for_ArcGIS_Windows_112_188250.exe",
                "WebStylesPath": null,
                "InstallDir": "C:\\ArcGIS\\Portal",
                "ContentDir": "C:\\ArcGISPortalDefault"
            },
            "ContentDirectoryLocation": "\\\\server.email.com\\share\\PROJECT\\Portal\\Content",
            "EnableAutomaticAccountCreation": true,
            "DefaultRoleForUser": "iAAAAAAAAAAAAAAA",
            "DefaultUserLicenseTypeIdForUser": "viewerUT",
            "PortalAdministrator": {
                "UserName": "portaladmin",
                "Email": "admin@email.com",
                "Password": "thePassword",
                "SecurityQuestionIndex": 1,
                "SecurityAnswer": "adfasdf"
            },
            "EmailSettings": {
                "SMTPServerAddress": "smtp@email.com",
                "From": "admin@email.com",
                "Label": "ArcGIS Portal",
                "AuthenticationRequired": false,
                "SMTPPort": 465,
                "EncryptionMethod": "TLS"
            },
            "EnableHSTS": false
        },
        "WebAdaptor": {
            "AdminAccessEnabled": true,
            "OverrideHTTPSBinding": true,
            "Installer": {
                "Path": "C:\\AWSSetup\\ArcGIS_Web_Adaptor_for_Microsoft_IIS_112_188253.exe",
                "IsSelfExtracting": true,
                "WebDeployPath": "C:\\AWSSetup\\WebDeploy_amd64_en-US.msi",
                "DotnetHostingBundlePath": "C:\\AWSSetup\\dotnet-hosting-6.0.25-win.exe"
            }
        }
    }
}.

In this example the shared storage is on server.email.com and the main host is svr1.email.com that portal is installed onto.

Expected Behavior

Actual Behavior

Trace-DSCJob : 1/16/2024 1:28:00 PM: PowerShell DSC resource ArcGIS_Portal  failed to execute Set-TargetResource
functionality with error message: Cannot read from directory path
'\\server.email.com\share\PROJECT\Portal'. Please check that the location is valid and that the Portal
service account has permissions to the location.
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\4.2.0\ArcGIS.psm1:261 char:5
+     Trace-DSCJob -Job $Job -JobName $ConfigurationName -DebugMode $De ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Trace-DSCJob

Trace-DSCJob : 1/16/2024 1:28:00 PM: The SendConfigurationApply function did not succeed.
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\4.2.0\ArcGIS.psm1:261 char:5
+     Trace-DSCJob -Job $Job -JobName $ConfigurationName -DebugMode $De ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Trace-DSCJob

Steps to Reproduce

I have not tested making a brand new repro for this but for me it was:

Important Factoids

The documentation says this on the 4.2.0 variables page:

ContentDirectoryLocation - The path where content of your new site will be initialized. Generally, it is the ContentDir mentioned above, followed by \arcgisportal\content, but it can be a completely independent path as well. For a Single Machine Portal this can be a Local Path (Ex. same as ContentDir), but for 2 Machine Portal this needs to be a Shared Location.

which does not mention the directory must exist, even if this is a brand new portal being brought up.

Manually creating the directory made it work. However, the documentation does not make it clear it does, and behavior with other directories not existing and being created but not this one seems inconsistent.

References

N/A

Biboba commented 10 months ago

Possible related issue: https://github.com/Esri/arcgis-powershell-dsc/issues/119

cameronkroeker commented 4 months ago

Thanks @mjperez-usgs for this suggestion. We have updated the v4.3.0 wiki variables page to include the following Note:

https://github.com/Esri/arcgis-powershell-dsc/wiki/v4.3.0-Variables-reference-page-for-JSON-configuration-files

Screenshot 2024-06-27 at 8 40 26 AM