New-UDform -script. SSL connection could not be established

I’m trying to use the:

New-UDform -script 

in an app.

Here is the documentation I’ve used for reference:


New-UDForm -Id ‘form10’ -Script “Script1.ps1” -OutputType “Table”

But I keep getting

An error occurred: Status(StatusCode=“Internal”, Detail=“Error starting gRPC call. HttpRequestException: The SSL connection could not be established, see inner exception. AuthenticationException: The remote certificate was rejected by the provided RemoteCertificateValidationCallback.”, DebugException=“System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.”)

New-UDform does not have a -trustedCertificate para.

My Script1.ps1 is located in the Automation → Scripts

So, how does this work exactly and how do I get it to accept my cert?

Hi,

try to make a connect-psuserver before using the New-UDForm.
Works for me (version 5.5.5)

What Security Mode do you have in your app settings?

Generally the gRPC error is because of a permission issue, if you have Strict mode, make sure that the user performing the action/visiting the page has permissions to Read the script in question.

Also if your script is in a folder, make sure you have the full path, not just the script name < this one tripped me up before with the Get-PSUScript cmdlet

Hi MS-Marox and insomniac

I’m also on Version 5.5.5

Here is the app I’ve tested with:




New-UDApp -Content { 
    

    ## For scheduled jobs
    $AppToken ='TOKEN'
    #Connect-PSUServer -AppToken $AppToken -ComputerName 'https://myapp.domain.com' ## <- This also does not work.. But I'm pretty sure I had it working at some point.
    Connect-PSUServer -AppToken $AppToken -ComputerName 'http://localhost:5000' ## This works

####
### Getting an overview of scripts, so that I can see the path ####
####

    $Data = Get-PSUScript -TrustCertificate | Select-Object Name, Filename, relativePath, id ## <- Have to 
    
    $columns = @(

        New-UDTableColumn -IncludeInExport -Property "Name" -Title "Name" -Id 'Name' -IncludeInSearch -showsort
        New-UDTableColumn -IncludeInExport -Property "Id" -Title "Id" -Id 'Id'  -showsort

    )

    New-UDTable -Columns $columns -Data $Data
    

#####
#### This is the test I'm trying to get working
#####
    New-UDForm -Script 'Test.ps1' -OutputType Table
   

}

I made sure to place my Test.ps1 in the root of automation. So there is no folder involved.

My App settings are pretty basic. I only remember adding https, so I’m not sure if it’s running in strict mode:



{
    "Kestrel": {
      "Endpoints": {
        "HTTP": {
          "Url": "http://*:5000"
        },
        "HTTPS": {
          "URL": "https://*.443",
          "Certificate": {
            "Subject": "myapp.domain.com",
            "Store": "My",
            "Location": "LocalMachine",
            "AllowInvalid": "true"
          }
        }
      }
    },
    "Plugins": [
        "SQLite"
      ],
      "Data": {
        "RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
        "ConnectionString": "Data Source=%ProgramData%\\UniversalAutomation\\database.db"
      }
  }

Some additional info: I’m running the app in a “custom” environment that points to pwsh.
I’m also using a service account on this custom environment to execute the job.