Forum Discussion

clint_simmons54's avatar
2 years ago

I'm attempting to use New-Pfa2Certificate to import

I'm attempting to use New-Pfa2Certificate to import an updated CA signed certificate: ```New-Pfa2Certificate -Certificate $cert1 -IntermediateCertificate $cert2 -Key $key -Passphrase $pp New-Pfa2Certificate: Missing or invalid parameter. (), https://ttpur002.gsm1900.org/api/2.17/certificates (POST)``` If I run it Verbose: ```VERBOSE: PureStorage.Rest Verbose: 13 : 2024-01-04T0322.8514223Z Error: Exception "PureRestException: HttpStatusCode = 'BadRequest', RestErrorCode = 'InvalidArgument', Details = '[{"context":,"message":"Missing or invalid parameter."},{"context":"POST","message":"https://arrayname/api/2.17/certificates"}]', InnerException = ''", StackTrace= at PureStorage.FlashArray.Rest.Api.CertificatesApi.Api224CertificatesPostWithHttpInfo(CertificatePost certificate, String authorization, String xRequestID, List`1 names, String apiVersion) at PureStorage.FlashArray.Rest.Rest2Api.c__DisplayClass133_0.Post_Certificatesb__0() at PureStorage.Rest.PureClient.DoRetries[T](String method, String path, String apiVersion, Func`1 retriable) VERBOSE: PureStorage.Rest Error: 12 : 2024-01-04T0322.8516374Z '"PureRestException: HttpStatusCode = 'BadRequest', RestErrorCode = 'InvalidArgument', Details = '[{"context":,"message":"Missing or invalid parameter."},{"context":"POST","message":"https://arrayname/api/2.17/certificates"}]', InnerException = ''"'``` I've also tried under SDK1 with Import-PfaCertificate (api 1.11) and Import-PfaNamedCertificate (api 1.12), but it chokes on importing the key: ```Import-PfaCertificate : [{"context": , "msg": "Failed to load the private key.\n", "ctx": "management"}] At line:1 char:1 + Import-PfaCertificate -Array $array -Certificate $cert1 -Intermediate ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Import-PfaCertificate], PureRestException + FullyQualifiedErrorId : PurePowerShell.ImportCertificateCmdlet``` I'm guessing I've flattened the key.pem incorrectly (adding line breaks and flattening it to single line same as the cert and intermediate cert). Any advice? Any other way to construct the key file for importing?
  • clint.simmons54 I now its a bother, but could you, when you have time, create an Issue so I can pass this on to ENG for review? https://github.com/PureStorage-Connect/PowerShellSDK2/issues
  • Thanks clint.simmons54 . It’s in our internal slack in front of engineering. We’ll see what they come back with.
  • I doubled up on the issue entry (parameter missing but not shown in the error & not overwriting existing cert) - let me know if you need 2 issues instead of 1
  • Just to be sure - New-Pfa2Certificate maps to the API2 certificate POST method for create/import as where Update-Pfa2Certificate matps to the MODIFY method that appears to be for self-signed certs only.