From within a VM with a System Assigned Identity (Not a User Assigned Managed Identity).
I am able to authenticate via the az cli by typing az login -identity and can perform operations based on the RoleAssignments to the VM's Service Principal.
However when I try to do the same using pwsh:
Connect-AzAccount -Identity I get an error:
WARNING: Unable to acquire token for tenant 'organizations' with error 'ManagedIdentityCredential authentication unavailable. No Managed Identity endpoint found.'
Connect-AzAccount: ManagedIdentityCredential authentication unavailable. No Managed Identity endpoint found.
However if I run Connect-AzAccount -Identity a second time immediately after it seems to work:
PS /root> Connect-AzAccount -Identity
Account SubscriptionName TenantId Environment
------- ---------------- -------- -----------
MSI@XXXXX <subscriptionName> <tenantId> AzureCloud
Is there something I can do to avoid having this warning displayed?
