title: Deploying azure automation account cert
body: <p>I generated a pfx blob using this script :</p>
  
  <pre><code>$appId = Read-Host "Enter application ID of service principal"
  $adApp = (Get-AzureRmADApplication -ApplicationId $appId)[0]
  $spnId = (Get-AzureRmADServicePrincipal -ServicePrincipalName $adApp.IdentifierUris[0])[0].Id.Guid
  
  $endDate = (Get-Date).AddYears(1)
  $certSelfSigned = New-SelfSignedCertificateEx -Subject "CN=$spnId" -StoreLocation CurrentUser -NotAfter $endDate -Exportable -Provider "Microsoft Enhanced RSA and AES Cryptographic Provider"
  $publicKey = [System.Convert]::ToBase64String($certSelfSigned.GetRawCertData())
  New-AzureRmADSpCredential -ServicePrincipalObjectId $spnId -CertValue $publicKey -EndDate $certSelfSigned.GetExpirationDateString()
  # TEST: Login-AzureRmAccount -ServicePrincipal -CertificateThumbprint $certSelfSigned.Thumbprint -ApplicationId $appId -TenantId &lt;guid&gt;
  
  $storeLocation = [Security.Cryptography.X509Certificates.StoreLocation]::CurrentUser
  $storeName = [Security.Cryptography.X509Certificates.StoreName]::My
  $store = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Store @($storeName, $storeLocation)
  $store.Open([Security.Cryptography.X509Certificates.OpenFlags]::OpenExistingOnly)
  $findType = [System.Security.Cryptography.X509Certificates.X509FindType]::FindByThumbprint
  $cert = $store.Certificates.Find($findType, $certSelfSigned.Thumbprint, $false)
  $pfxBlob = [System.Convert]::ToBase64String($cert.Export([Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12))
  $store.Close()
  
  "THUMBPRINT: $($certSelfSigned.Thumbprint)"
  "PFX BLOB: `n$pfxBlob"
  </code></pre>
  
  <p>I copied the pfx blob and made a .pfx file and in azure portal when I create a new certificate for an automation account and upload the file I created before it gives me internal server error.</p>
  
  <p>What is the correct format of .pfx file and what is the password that I will be using to set and how will I use a thumbprint?</p>