Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
add msi detecting
Browse files Browse the repository at this point in the history
  • Loading branch information
yugangw-msft committed Nov 2, 2018
1 parent 421d0a3 commit 717ff62
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions msrestazure/azure_local_creds_prober.py
Expand Up @@ -85,6 +85,13 @@ def probe(self):
if not self.enabled:
return None
try:
# detect we are inside a VM with identity
_ = requests.get('http://169.254.169.254/metadata/identity/oauth2/token',
params={'api-version': '2018-02-01',
'resource':'https://management.core.windows.net/'},
headers={'Metadata': 'true'},
timeout=1)

creds = MSIAuthentication()
# MSI is not yet supported in sovereigns
setattr(creds, 'cloud_environment', AZURE_PUBLIC_CLOUD)
Expand Down

0 comments on commit 717ff62

Please sign in to comment.