wapacro / az-keyvault-php

Library to easily work with Azure Key Vault using managed identities
https://packagist.org/packages/wapacro/az-keyvault-php
MIT License
17 stars 15 forks source link

connection refused #9

Closed Supertimor closed 3 years ago

Supertimor commented 3 years ago

Hi,

From my azure app service i m getting this error:

error 7: Failed to connect to 169.254.169.254 port 80: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://169.254.169.254/metadata/identity/oauth2/token?resource=https%3A%2F%2Fvault.azure.net&api-version=2019-08-01

So i can't get the token from the AD. Any idea?

Thanks,

wapacro commented 3 years ago

Hi @Supertimor Did you enable a system-assigned managed identity on your app service and tried restarting the app afterwards?

IGotNothin commented 3 years ago

I see the same thing. I assigned a system assigned user identity and restarted. This works on a VM but not on an app service.

IGotNothin commented 3 years ago

Actually, nevermind. The url provided above is what you'd use for a VM, but your code is properly pulling the environment variables as described here https://docs.microsoft.com/en-us/azure/app-service/overview-managed-identity?tabs=dotnet#obtain-tokens-for-azure-resources. Thanks for your work on this!

wapacro commented 3 years ago

Closed due to inactivity. Please upgrade to the newest version and reopen if the issue persists.