I am trying to use 'importExistingServerCertificate' using powershell and REST API and I get the error 'Unable to find root ca certificate.
$rootUri = 'https://<server.domain.com>:6443/arcgis/admin/machines/<machine name>/sslcertificates/importExistingServerCertificate'
$params = @{
alias = 'mapcert';
certPassword = '<password>';
certFile = 'c:\certificates\<certname>.pfx';
f = 'json'
}
Invoke-RestMethod -Uri $rootUri -Method Post -Body $params
I can manually install the certificate from the arcgis/admin/machines/<> page no issues, but when trying to automate it is when it throws the error. @JoshuaBixby Hoping you might be able to help 😁
Thanks,
Noel
With the Esri Admin API call, you need to include the file in the POST body. Your current code is including a path to a file and not the contents of the file.
@JoshuaBixby forgive my ignorance but would just adding a get-content ie $cert = get-content c:\certificate\certificate.pfx then making the parameter for certFile = $cert resolve this?
Maybe I am over simplifying but I was under the impression the rest api call would read the certificate like it does in the admin page.
In the Admin API page, there is a "Choose File" button. That button isn't about giving ArcGIS Server the path to the file on your machine, which it can't do anything with anyways, that button is actually uploading the contents of the file in the browser session so that when you hit Submit the file contents can be sent.