terraform-provider-netapp-cloudmanager icon indicating copy to clipboard operation
terraform-provider-netapp-cloudmanager copied to clipboard

Azure CLI - 'az' is not recognized as an internal or external command, operable program or batch file.

Open sam-bryant opened this issue 2 months ago • 2 comments

We are encountering an error when performing an apply and believe it is related to this provider requiring the 32 bit version of the Azure CLI. We currently use the 64 bit version on our local machines as well as on our servers. We installed the 32 bit version and got past the error but are hoping this can be changed to use the 64 bit version.

Resource

resource "netapp-cloudmanager_connector_azure" "main" {
  name                            = "example"
  location                        = "centralus"
  subscription_id                 = module.global_variables.subscriptions.global_sharedservices.id
  company                         = "example"
  resource_group                  = module.resource_group.azurerm_resource_group.name
  virtual_machine_size            = "Standard_D8s_v5"
  subnet_id                       = "snet-example"
  vnet_id                         = module.global_variables.vnets.global_sharedservices.vnet_sharedservices.resource_id
  network_security_group_name     = "nsg-example"
  network_security_resource_group = "rg-example"
  associate_public_ip_address     = false
  storage_account                 = module.storage_account.azurerm_storage_account.name
  account_id                      = "xyz"
  admin_password                  = data.azurerm_key_vault_secret.admin_password.value
  admin_username                  = "example"
}

Error

netapp-cloudmanager_connector_azure.main: Creating...

│ Error: cannot authorize: Invoking Azure CLI failed with the following error: 'az' is not recognized as an internal or external command, │ operable program or batch file. │ │ │ with netapp-cloudmanager_connector_azure.main, │ on main.tf line 59, in resource "netapp-cloudmanager_connector_azure" "main": │ 59: resource "netapp-cloudmanager_connector_azure" "main" {

sam-bryant avatar Oct 02 '25 16:10 sam-bryant

Hi,

Based on the error message, looks like the az command isn't found in your system's PATH. The best solution is to:

Use environment variable authentication (recommended for CI/CD and automated workflows) Or fix the PATH to include the Azure CLI installation directory

provider "netapp-cloudmanager" { refresh_token = var.cloudmanager_refresh_token

Try environment variables first, then Azure CLI

azure_auth_methods = ["env", "cli"] }

On Mac/Linux

export ARM_CLIENT_ID="your-service-principal-client-id" export ARM_CLIENT_SECRET="your-service-principal-client-secret" export ARM_TENANT_ID="your-azure-tenant-id" export ARM_SUBSCRIPTION_ID="your-azure-subscription-id"

On Windows

$env:ARM_CLIENT_ID="your-service-principal-client-id" $env:ARM_CLIENT_SECRET="your-service-principal-client-secret" $env:ARM_TENANT_ID="your-azure-tenant-id" $env:ARM_SUBSCRIPTION_ID="your-azure-subscription-id"

suhasbshekar avatar Oct 02 '25 17:10 suhasbshekar

It believe it is on my path. I do an "az login" all the time. Found this on my system Path variable: C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin (which has az) in the directory. We use this a lot for Terraform and PowerShell development.

We use the Azure CLI authentication within our CI/CD pipelines as well.

sam-bryant avatar Oct 02 '25 18:10 sam-bryant