1

When you create a new appservice plan you need define the wanted SKU (size/tiers)

How get the list of availables SKU sizes/tiers definitions with REST Api? (like here: https://azure.microsoft.com/en-us/pricing/details/app-service/linux)

It must be possible...

Thanks

Fab
  • 29
  • 3

2 Answers2

0

I created an Azure AD Application and granted API permissions like below:

enter image description here

I generated access token using below parameters via Postman:

https://login.microsoftonline.com/TenantID/oauth2/v2.0/token

client_id:ClientID
grant_type:authorization_code
scope:https://management.azure.com/user_impersonation
code:code
redirect_uri:https://jwt.ms
client_secret:ClientSecret

enter image description here

To get all App Service plans for a subscription, use the below query:

https://management.azure.com/subscriptions/SubscriptionID/providers/Microsoft.Web/serverfarms?api-version=2022-03-01

enter image description here

Or try this,

GET https://management.azure.com/subscriptions/SubscriptionID/providers/Microsoft.Web/skus?api-version=2022-03-01

Otherwise, for a given App Service Plan you can list the SKUs by using below query:

GET https://management.azure.com/subscriptions/SubscriptionIS/resourceGroups/RGName}/providers/Microsoft.Web/serverfarms/name/skus?api-version=2022-03-01

References:

App Service Plans - List - REST API (Azure App Service)

App Service Plans - Get Server Farm Skus - REST API

Rukmini
  • 6,015
  • 2
  • 4
  • 14
0

Thank you very much for your topic Rukmini.. Indeed I had not thought that there was an authorization API to activate.. it seems logical but I find that it remains very strange to have a single role. It should be known that today my application already uses azure management resource api to create and administer resources so why should I have to activate this to consult information that has absolutely nothing critical compared to what I already use (creation of resources, deletion...)...

After this remark unfortunately I can't get your result...

I :

  • Create an application
  • Allow the access Azure Service Management on user_impersonation

Login scope

  1. Impossible to use the scope https://management.azure.com/user_impersonation*
  • Error : AADSTS1002012: The provided value for scope https://management.azure.com/user_impersonation is not valid. Client credential flows must have a scope value with /.default suffixed to the resource identifier (application ID URI).
  1. I set the scope with : https://management.azure.com/user_impersonation/.default
  • Error : AADSTS500011: The resource principal named https://management.azure.com/user_impersonation was not found in the tenant named -----. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.

At this point in my azure.portal the access is consent I don't understand this error..?

The role

  1. I connect on scope https://management.azure.com/.default to walkaround because here the connection is Ok

  2. I GET https://management.azure.com/subscriptions/SubscriptionID/providers/Microsoft.Web/skus?api-version=2022-03-01

  • Error : *The client XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX with object id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX does not have authorization to perform action Microsoft.Web/skus/read over scope /subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX or the scope is invalid. If access was recently granted, please refresh your credentials.
  1. I undestand here the application is not allowed to access on this resource BUT when i search the action Microsoft.Web/skus/read with GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-04-01 I not found this actions!?? (I try on subscription scope and root scope /)

  2. I add the role Reader on my subscription : he contains */read

  • Result :

    { "value": [] }

  1. For finish i try with add role API Management Service Contributor and Contributor but the result is always the same.. (empty)

PS : my subscription is Microsoft Partner Network

Fab
  • 29
  • 3