markdomansky / WebJEA

WebJEA - Secure Self Service Web Forms from PowerShell Scripts
GNU General Public License v3.0
236 stars 27 forks source link

unable to retrieve Managed Identity token #94

Closed CrispBe-2023 closed 1 year ago

CrispBe-2023 commented 1 year ago

Powershell command that targets the special local IP address (169.254.169.254) fails. No issue if running same command directly within Powershell but always times out when run from WebJEA. Command is retrieving the authorization token for a managed identity on an Azure VM. Which is then used to access an Azure KeyVault. commandline = Invoke-RestMethod -Headers @{"Metadata"="true"} -Method GET -Uri "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net"

Extract from powershell log = ... This Page Cannot Be Displayed The system cannot communicate with the external server ( 169.254.169.254 ). The Internet server may be busy, may be permanently down, or may be unreachable because of network problems. Please check the spelling of the Internet address entered. If it is correct, try this request later. If you have questions, please contact your organization's network administrator and provide the codes shown below. Date: Mon, 12 Jun 2023 07:32:35 NZST Username: Source IP: ... URL: GET http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fvault.azure.net Category: Infrastructure and Content Delivery Networks Reason: UNKNOWN Notification: GATEWAY_TIMEOUT

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.