1
votes

I'm an owner of an Azure resource group but not have permissions on the subscription or on the management group. When configuring the "azurerm" provider inside my .tf file, I've added subscription id and tenant id (I'm not the owner of that subscription).

--------------------- UPDATE ---------------------

I'm trying to apply Linux virtual machine using Terraform but having authorization issues while planning the .tf file. enter image description here

I've listed all my accounts using Azure CLI (want to connect the second subscription in the output below): enter image description here

I've succeeded authenticating to the subscription using Azure CLI with the command (it worked):

az account set --subscription="SUBSCRIPTION_ID"

It's my default and current subscription: enter image description here

Also, I was able to create and manage resources inside my resource group in that subscription using Azure CLI. However, I added the exact tenant ID and the exact subscription ID inside my .tf file and still got the same credentials errors during the "terraform plan". enter image description here

Using Azure CLI or Azure portal I am able to create and manage resources inside the resource group's scope, although using terraform I'm facing problems.

Thank you :)

1
Make sure you logged in to the right subscription : az login --subscription %Subscription_ID%Amit Baranes

1 Answers

0
votes

According to your story, you just set the tenant id and subscription id in the azure provider, so it seems you authenticate via Azure CLI. No matter you have a user account or a service principal, the owner role of the resource group is enough to create virtual machine in the resource group. In this way, you need to logging into the Azure CLI first. As it shows in the link I have provided.