kubernetes/kops · error

error creating an identity: %s

Error message

error creating an identity: %s

What it means

azidentity failed to construct a DefaultAzureCredential while newAzureCloud was initializing the cloud interface — no usable credential source (env vars, managed identity, CLI login) was available in the environment.

Source

Thrown at upup/pkg/fi/cloudup/azure/azure_cloud.go:116

	defer azureCloudInstancesMutex.Unlock()
	azureCloudInstances[subscriptionID+"::"+resourceGroupName] = cloud
}

// NewAzureCloud creates a new AzureCloud, or returns a cached instance for the given subscription and resource group.
func NewAzureCloud(subscriptionID, resourceGroupName, location string, tags map[string]string) (AzureCloud, error) {
	azureCloudInstancesMutex.RLock()
	i := azureCloudInstances[subscriptionID+"::"+resourceGroupName]
	azureCloudInstancesMutex.RUnlock()
	if i != nil {
		return i, nil
	}
	return newAzureCloud(subscriptionID, resourceGroupName, location, tags)
}

func newAzureCloud(subscriptionID, resourceGroupName, location string, tags map[string]string) (AzureCloud, error) {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		return nil, fmt.Errorf("error creating an identity: %s", err)
	}

	azureCloudImpl := &azureCloudImplementation{
		subscriptionID:    subscriptionID,
		resourceGroupName: resourceGroupName,
		location:          location,
		tags:              tags,
	}

	if azureCloudImpl.resourceGroupsClient, err = newResourceGroupsClientImpl(subscriptionID, cred); err != nil {
		return nil, err
	}
	if azureCloudImpl.vnetsClient, err = newVirtualNetworksClientImpl(subscriptionID, cred); err != nil {
		return nil, err
	}
	if azureCloudImpl.subnetsClient, err = newSubnetsClientImpl(subscriptionID, cred); err != nil {
		return nil, err
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set AZURE_CLIENT_ID/AZURE_CLIENT_SECRET/AZURE_TENANT_ID or run 'az login'
  2. If using managed identity, verify it is available on the host
  3. Check the wrapped error for the specific credential chain failure
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/azure/azure_cloud.go:116 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/b3039f25243f585b. Report an issue: GitHub.