I am trying to get all vm size name from my Azure account and I am using This approach In site when I click try out I am getting back result which I need.
Json look like:
{
"value": [
{
"name": "Standard_D1_v2",
"numberOfCores": 1,
"osDiskSizeInMB": 1047552,
"resourceDiskSizeInMB": 51200,
"memoryInMB": 3584,
"maxDataDiskCount": 4
},
{
"name": "Standard_D2_v2",
"numberOfCores": 2,
"osDiskSizeInMB": 1047552,
"resourceDiskSizeInMB": 102400,
"memoryInMB": 7168,
"maxDataDiskCount": 8
},
}
And after logged in microsoft gets token and request looks like:
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/North%20Europe/vmSizes?api-version=2019-12-01
Authorization: Bearer {{token.....}}
I need to get token for making request which I don't know, I have credentials like:
azure_client_id azure_client_secret azure_tenant_id azure_subscription_id
Using this credentials how can I achieve this json result, in short how can I get token.
Tried approaches:
This one Read this but no info investigated also this one also this question in stackoveflow
P.S. I am using aspnet core 3.1 web app maybe it is better client for azure. I used ComputeClient but no success. In final I thought using httpclient but first of all I need to test with postman.