-
Notifications
You must be signed in to change notification settings - Fork 708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug report- grant_consent.sh script fails under service principal context #1244
Comments
This issue seems to be related to azure cli version.
In azure-cli 2.37.0 the underlying Active Directory Graph API was replaced by Microsoft Graph API |
@wasfree I am not so familiar in this material. What should be the next step, or is this something that needs to be fixed in the CAF framework/modules ? |
You might want to try with an updated version of rover using the azure cli 2.37 - typically latest rover should help - |
@arnaudlh upgrading azure cli version to 2.37.0 has downside hashicorp/terraform-provider-azurerm#7787 seems datasource data.azurerm_client_config is empty until azurerm provider version 3.9.0. |
thats correct @wasfree - seems like the refactoring was not smooth in the cli/provider. It has impact if you are consuming the module as standalone, BUT if you are leveraging the rover commands and contexts, we are fixing that glitch automatically for you with querying and re-injecting the vars (see https://github.com/aztfmod/terraform-azurerm-caf/pull/1185/files) |
Thanks @arnaudlh I will try the version of the Rover you mentioned next week. Will let you know.... |
bumping the rover version up to |
Is there an existing issue for this?
Community Note
Version of the module you are using
5.5.9
Rover Version
aztfmod/rover:1.1.7-2203.2311
Terraform Version
No response
AzureRM Provider Version
No response
Affected Resource(s)/Data Source(s)
azuread_service_principal
Terraform Configuration Files
Expected Behaviour
Background info : I am deploying a lvl4 workload configuration that uses a service principal (for IaC deployment) with basically only permission of the workload subscription. Temporarily added this workload SP to Global Admin role, so I can use this service principal to create another Service Principal that needs Graph API permissions assigned and consent granted.
I expect the results to be that an App registration is created with API permissions set including Admin Consent granted.
Actual Behaviour
The actual result is that the API permissions are assigned, but consent grant fails because the ${resourceId} is not populated when running under the context of a Service Principal (with Global Admin privilege).
az login --service-principal --allow-no-subscriptions -u ${ARM_CLIENT_ID} -p=${ARM_CLIENT_SECRET} --tenant ${ARM_TENANT_ID}
az ad sp show --id "00000003-0000-0000-c000-000000000000" --query "id" -o tsv
gives no outputWhen I run the last command under "normal" user context I receive output.
So under the context of the SP this is found in the logging (example from 1 API permission)
It appears to me that his became an issue after this commit where the objectId was changed to id. Because before this commit the logic just worked fine under the same circumstances. Possibly due to an update to the AZ CLI I reckon.
Steps to Reproduce
I guess enough info is added already
Important Factoids
No response
References
No response
The text was updated successfully, but these errors were encountered: