trying to attain a list of regions/locations from Microsoft Azure that contain the term 'health'. A function that will analyze a .csv file.
I used the following function:
regions = monitor_client.location.list('health')
And received the following error:
AttributeError: 'MonitorManagementClient' object has no attribute 'location'
Is there something that's missing. Is the location attribute present within MonitorManagementClient in Microsoft Azure. Is the location module deprecated?
regions = monitor_client.location.list('health')
Hoping to return a list of all available Azure regions/locations with 'Health'
Edit: Having issue with regions with regards to Environment Variables
DefaultAzureCredential failed to retrieve a token from the included credentials. Attempted credentials: EnvironmentCredential: EnvironmentCredential authentication unavailable. Environment variables are not fully configured. Visit https://aka.ms/azsdk/python/identity/environmentcredential/troubleshoot to troubleshoot.this issue. ManagedIdentityCredential: ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint. SharedTokenCacheCredential: SharedTokenCacheCredential authentication unavailable. No accounts were found in the cache. VisualStudioCodeCredential: Failed to get Azure user details from Visual Studio Code. AzureCliCredential: Please run 'az login' to set up an account AzurePowerShellCredential: Az.Account module >= 2.2.0 is not installed To mitigate this issue, please refer to the troubleshooting guidelines here at https://aka.ms/azsdk/python/identity/defaultazurecredential/troubleshoot.
Left with this error when trying to get the list of regions. Have the Subscription ID, credential, and resource_client set. Still, don't understand why the error continues to appear.
Does it require the following? AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
By default any Azure regions does not contain Health in its name as, Region names are the name of the Countries where Azure data centres exists. And MonitorManagementClient does not include any parameter with list_locations or locations. Refer these documents:-
azure.mgmt.monitor.MonitorManagementClient class | Microsoft Learn
azure-docs/cloud-services-python-how-to-use-service-management.md at main · MicrosoftDocs/azure-docs · GitHub
I tried using MonitorManagementClient to get list of Azure regions with Health in their name and received an error below:-
I used the code below to get all the Azure regions with Health in its name and got no results:-
Output:-
In order to get the list of all regions, You can make use of the code below:-
Code 1:-
Output:-
If you want to check the resource health of your resources, You can make use of the code below to get the availability status of the resources by their regions or at subscription level:-
Code 1:- Availability status by Subscription:
Output:-
Resource Type by regions:-
Code2 :-
As, We do not have any health issues in our VM in UK south region, It returned the response below:-
Output:-