title: How to retrieve thumbprint expiry date of enterprises application in azuread
body: <p>How to retrieve thumbprint expiry date of enterprises application in the azure ad using PowerShell in CSV format</p>
  <pre><code>Clear-Variable  diskreport3 -ErrorAction SilentlyContinue
  If($connect -eq $null){$connect = Connect-AzureAD }
  
  $allService = Get-AzureADServicePrincipal
  
  
  ForEach ($i in $allService)
  {
  
  Clear-Variable  Thumbprint -ErrorAction SilentlyContinue
  $details = Get-AzureADServicePrincipalKeyCredential -ObjectId $i.ObjectID
  $CustomKeyIdentifier = (Get-AzureADServicePrincipalKeyCredential -ObjectId $i.ObjectID).CustomKeyIdentifier
  if($CustomKeyIdentifier -eq $null ){$Thumbprint = $null}
  else{
  $Thumbprint = [System.Convert]::ToBase64String($CustomKeyIdentifier)
  }
  
  
  $app=$i.displayname
  $start = $details.StartDate
  $end = $details.EndDate
  $type = $details.Type
  
  $dataRow = &quot;
  &lt;/tr&gt;
  &lt;td&gt;$app&lt;/td&gt;
  &lt;td&gt;$start&lt;/td&gt;
  &lt;td&gt;$end&lt;/td&gt;
  &lt;td&gt;$Thumbprint&lt;/td&gt;
  &lt;td&gt;$type&lt;/td&gt;
  &lt;/tr&gt;
  &quot;
  $diskreport3 += $datarow
  }
  
  
  $report = &quot;&lt;html&gt;
  &lt;style&gt;
  {font-family: Arial; font-size: 13pt;}
  TABLE{border: 1px solid black; border-collapse: collapse; font-size:13pt;}
  TH{border: 1px solid black; background: #dddddd; padding: 5px; color: #000000;}
  TD{border: 1px solid black; padding: 5px; }
  &lt;/style&gt;
  &lt;h2&gt;Azure Service Principal details  &lt;/h2&gt;
  &lt;table&gt;
  &lt;tr&gt;
  &lt;th&gt;APP&lt;/th&gt;
  &lt;th&gt;Startdate&lt;/th&gt;
  &lt;th&gt;EndDate&lt;/th&gt;
  &lt;th&gt;Thumbprint&lt;/th&gt;
  &lt;th&gt;Type&lt;/th&gt;
  &lt;/tr&gt;
  $diskreport3
  &lt;/table&gt;
  &lt;tr&gt;
  &quot;
  
  $report | Out-File &quot;C:\temp\Azuread\data.html&quot;
  </code></pre>
  <p>I tried this but I am not getting a proper thumbprint.
  thumbprint is different in AzureAd</p>
  <p>actually, the requirement is in CSV we need App name start date expiry date and thumbprint</p>