Skip to content

The subscription could not be found at AzureChinaCloud #1

@sfairat15

Description

@sfairat15

We are trying to use azure-metric-exporter at our Azure China Cloud.

We set up next env variables:

AZURE_ENVIRONMENT=AzureChinaCloud
AZURE_AD_RESOURCE=https://management.chinacloudapi.cn/

But get errors:

{"file":"probe_metrics_list.go:66","func":"func1","level":"error","msg":"resources.Client#List: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code=\"SubscriptionNotFound\" Message=\"The subscription '**REDACTED**' could not be found.\"","paramFilter":["resourceType eq 'Microsoft.DBforMySQL/servers'"],"paramMetric":["cpu_percent,memory_percent,io_consumption_percent,storage_percent,storage_used,storage_limit,serverlog_storage_percent,serverlog_storage_usage,serverlog_storage_limit,active_connections,connections_failed,seconds_behind_master,backup_storage_used,network_bytes_egress,network_bytes_ingress"],"paramSubscription":["**REDACTED**"],"requestPath":"/probe/metrics/list"}

So, we added next env variable for debugging:

AZURE_GO_SDK_LOG_LEVEL=DEBUG

Found next log at console:


(2020-12-02T13:08:27.6596240Z) INFO: REQUEST: GET https://management.azure.com/subscriptions/**REDACTED**/resources?%24filter=resourceType+eq+%27Microsoft.DBforMySQL%2Fservers%27&api-version=2019-10-01
User-Agent: Go/go1.15.5 (amd64-linux) go-autorest/v14.2.1 Azure-SDK-For-Go/v45.1.0 resources/2019-10-01
Authorization: **REDACTED**
(2020-12-02T13:08:28.2904529Z) INFO: RESPONSE: 404 https://management.azure.com/subscriptions/**REDACTED**/resources?%24filter=resourceType+eq+%27Microsoft.DBforMySQL%2Fservers%27&api-version=2019-10-01
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
X-Ms-Request-Id: fae942b9-653c-4c89-9acc-dc89766b919e
X-Content-Type-Options: nosniff
Date: Wed, 02 Dec 2020 13:08:27 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Length: 129
Pragma: no-cache
Expires: -1
X-Ms-Failure-Cause: gateway
X-Ms-Correlation-Request-Id: fae942b9-653c-4c89-9acc-dc89766b919e
X-Ms-Routing-Request-Id: KOREACENTRAL:20201202T130828Z:fae942b9-653c-4c89-9acc-dc89766b919e


Resolution:

Looks like application should use another methods at azure_insights.go file, instead of simple NewClient and NewMetricsClient calls, app should use another with BaseUrl parameter, according to Azure Cloud.
By default, BaseUrl point to https://management.azure.com/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions