Search code examples
pythonazure-application-insightsopencensus

Ingestion is allowed only from stamp specific endpoint (Azure East US 2)


I am getting this error starting this weekend for Azure East US 2 region. This may also be happening in other regions that I am not aware of.

The code was logging to appinsights last week.

Non-retryable server side error 404: {"itemsReceived":12,"itemsAccepted":0,"errors":[{"index":0,"statusCode":404,"message":"Ingestion is allowed only from stamp specific endpoint - Location: https://eastus2-3.in.applicationinsights.azure.com/v2.1/track","location":"https://eastus2-3.in.applicationinsights.azure.com/v2.1/track","cacheControl":"max-age=604800"},{"index":1,"status ....

Code:

import logging
from opencensus.ext.azure.log_exporter import AzureLogHandler
logger = logging.getLogger(__name__)

logger.addHandler(AzureLogHandler(
    connection_string='InstrumentationKey=672e7b1f-......')
)

logger.warning("This is a logger warning")

UPDATE: Putting full connection string fixed the issue. Still this breaking change seems like unreliable, and sudden (over the weekend the code which was working fine, has stopped working).

I am happy that I DID NOT USED AppInsights yet for software shipped to customer site.

UPDATE 3 hrs later: Apparently, something changed on Azure and things have started working again without placing full connection string. (Thank you, Microsoft). We will accelerate the connection string change now, but without panic.


Solution

  • Try using a connection string instead of instrumentation key.

    Apparently, "new" regions require ConnectionString for ingestion.

    On March 31st, 2025, support for instrumentation key ingestion will end. Instrumentation key ingestion will continue to work, but we’ll no longer provide updates or support for the feature. Transition to connection strings to take advantage of new capabilities.

    See: