0

I have a python script where I want to check transaction number for my storage account, I am using:

`cred = DefaultAzureCredential()    
client_metrics = MetricsQueryClient(cred)

#the response is provided as timeseries data with daily number of transactions for past 30 days
response = client_metrics.query_resource(
    resource_id,
    metric_names=["Transactions"],
    timespan=timedelta(days=30),
    granularity=timedelta(days=1),
    aggregations=[MetricAggregationType.TOTAL]
)`

When I run it I'm getting a warning:

/opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/urllib3/connectionpool.py:1103: InsecureRequestWarning: Unverified HTTPS request is being made to host 'management.azure.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#tls-warnings warnings.warn(

I have run it locally (VS Code, Windows) and on Github Actions (using OIDC), and keep getting the same warning (with different path at the beginning), but only when I run with |& tee -a output.txt to collect both stdout and stderr.

I am quite new to Azure and APIs in general, how can I make the connection safer?

1 Answer 1

1

try updating azure-monitor-query to the latest version 1.2.1. You may be pinning to an older version somewhere. You should try and make sure that azure-monitor-query>=1.2.1.

pip install --upgrade azure-monitor-query
Sign up to request clarification or add additional context in comments.

1 Comment

Heyy it worked, thank you! I had installed azure-cli 2.58.0 (newest release), but apparently it contains azure-monitor-query 1.2.0, so upgrading it fixed it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.