theforeman / foreman_azure_rm

Adds Azure Resource Manager as a compute resource for The Foreman
GNU General Public License v3.0
9 stars 24 forks source link

Unable to add Azure provider to The Foreman to provision VMs using Azure Resource Manager #193

Open khain0 opened 1 day ago

khain0 commented 1 day ago

I want to provision Virtual Machines on The Foreman using Azure REsource MAnager. I follow this guides: https://github.com/theforeman/foreman_azure_rm https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app?tabs=client-secret https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-configure-app-expose-web-apis After trying to load Azure Regions I get an error. No idea how to set up Scopes on Microsoft Entra admin center. The error is: Unable to save { "message": "MsRestAzure::AzureOperationError: AuthorizationFailed: The client 'CENSORED' with object id 'CENSORED' does not have authorization to perform action 'Microsoft.Resources/subscriptions/locations/read' over scope '/subscriptions/CENSORED' or the scope is invalid. If access was recently granted, please refresh your credentials.", "request": { "base_uri": "https://management.azure.com/", "path_template": "subscriptions/{subscriptionId}/locations", "method": "get", "path_params": { "subscriptionId": "CENSORED" }, "skip_encoding_path_params": null, "query_params": { "api-version": "2019-06-01" }, "skip_encoding_query_params": null, "headers": { "Content-Type": "application/json; charset=utf-8", "Accept": "application/json", "accept-language": "en-US", "x-ms-client-request-id": "CENSORED" }, "body": null, "middlewares": [ [ "MsRest::RetryPolicyMiddleware", { "times": 3, "retry": 0.02 } ], [ "cookie_jar" ] ], "log": null }, "response": { "body": "{\"error\":{\"code\":\"AuthorizationFailed\",\"message\":\"The client 'CENSORED' with object id 'CENSORED' does not have authorization to perform action 'Microsoft.Resources/subscriptions/locations/read' over scope '/subscriptions/CENSORED' or the scope is invalid. If access was recently granted, please refresh your credentials.\"}}", "headers": { "Cache-Control": "no-cache", "Pragma": "no-cache", "Content-Length": "408", "Content-Type": "application/json; charset=utf-8", "Expires": "-1", "x-ms-failure-cause": "gateway", "x-ms-request-id": "CENSORED", "x-ms-correlation-request-id": "CENSORED", "x-ms-routing-request-id": "WESTEUROPE:20241009T093509Z:CENSORED", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "X-Cache": "CONFIG_NOCACHE", "X-MSEdge-Ref": "Ref A: CENSORED Ref B: CENSORED Ref C: 2024-10-09T09:35:09Z", "Date": "Wed, 09 Oct 2024 09:35:09 GMT" }, "status": 403 } }

chris1984 commented 1 day ago

That sounds like a permissions issue, you need to goto subscriptions in the Azure portal and add your app registration as a owner/contributor so it has access to the entities within the subscription

chris1984 commented 1 day ago

https://stackoverflow.com/questions/50719376/how-to-grant-subscription-access-to-an-azure-registered-application

khain0 commented 3 hours ago

Thanks for pieces of information. I do not have privileges to assign a role for my subscription, but I contacted my admin.