Unable to create azure resource group by using Terraform command in PowerShell

Jayesh Mhatre 5 Reputation points
2024-08-29T05:14:50.79+00:00

Unable to create Azure resource group by using Terraform command in PowerShell

error- Error: subscription_id is a required provider property when performing a plan/apply operation

As checked my subsciption is Active

(Taken code from official website link- https://registry.terraform.io/providers/hashicorp/azurerm/latest)

terraform {

required_providers {

azurerm = {

  source = "hashicorp/azurerm"

  version = "4.0.1"

}

}

}

provider "azurerm" {

features {}

}

resource "azurerm_resource_group" "RGJayesh" {

name = "JayeshRG1"

location = "West Europe"

}

Please help me to fix this issue

Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,170 questions
Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,501 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Prrudram-MSFT 24,366 Reputation points
    2024-08-29T09:48:46.04+00:00

    Hi @Jayesh Mhatre

    Happy to help!

    The subscription_id property is missing in your Terraform configuration file.

    To fix this issue, you need to add the subscription_id property to your Terraform configuration file. You can get the subscription ID from the Azure portal or by using the Azure CLI. Here is an example of how to add the subscription_id property to your Terraform configuration file:

    provider "azurerm" {
      subscription_id = "your-subscription-id"
      # other provider properties
    }
    
    # other resources
    
    

    If this is the first time you are working on this topic, you can refer to the below blog which i found to be clear and precise https://www.geeksforgeeks.org/how-to-create-azure-resource-group-using-terraform/
    If I have answered your query, please click "Accept as answer" as a token of appreciation

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.