0
votes

I am facing issues from azure metadata service when I am trying to run my terraform plan. Things I tried.

  • removing ~/.azure folder , re-tried az login from browser.
  • removed ~/.Identity folder as well , but still the same.
  • Also added client_id , client_secret , etc from provider block but no luck.
Error: retrieving environments from Azure MetaData service: Get "https:///metadata/endpoints?api-version=2019-05-01": http: no Host in request URL

  on main.tf line 1, in provider "azurerm":
   1: provider "azurerm" {

Any help would be greatly appreciated. I tried already to check if this was raised before but no luck.

1
@snakechamberb sorry but just I saw you edit the subject and removed terraform part - That was indeed my ,main point. when I am using terraform this az login is broken.vgdub
Could you share the part of your terraform configuration where you declare azurerm provider? Also, it might help if you add to the question description terraform version, azurerm provider version, how you configure terraform (environment-variables, terraform properties, etc)Ihor Kliushnikov

1 Answers

0
votes

I was able to fix this issue by doing 2 things mentioned below.

  • remove the ~/.azure and ~/.Identitiy folder from local.
  • export ARM_MSI_ENDPOINT=false

Once you do that you should now be able to access the metadata API again for authentication to azure.

Explanation of MSI flag is here terraform provider MSI use

I wanted to use service principal to authenticate and somehow I got this enabled in provider.