title: Is it possible to somehow cast or convert a WindowsIdentity type to PSCredential type?
body: <p>Context: working in PowerShell, need PSCredential object, have an object of WindowsIdentity type. </p>
  
  <p>Say you obtain WindowsIdentity type using:</p>
  
  <p>"[Security.Principal.WindowsIdentity]::GetCurrent()"</p>
  
  <p>You need PSCredential object to make a network call, e.g., Invoke-RestMethod.</p>
  
  <p>Instead of calling the usual Get-Credential and prompting the user for username and pw, can we actually use the current security context to create a credential object? e.g, can we cast the WindowsIdentity object into the PSCredential (if not directly - then through a sequence of steps?).</p>
  
  <p>If not then any other ideas about creating a PSCredential object from current security context (without specifying username or password - or storing encrypted username and pw as that would also require updating as the passwords change)?</p>
  
  <p>Similar questions have probably been asked before but I could not find an approach of trying to convert WindowsIdentity into PSCredential type - or any definitive answer on why this might be prevented by design. If this is not fundamentally possible - what might be the reason for not supporting it? Do you see any plausible workaround? 
  (I tried to add a tag: PSCredential but this tag does not already exist and I do not have enough reputation to create it: I would like to add that tag: perhaps someone from the community can add it. Thanks)</p>