terraform-provider-azuread icon indicating copy to clipboard operation
terraform-provider-azuread copied to clipboard

Error: Listing service principals for filter "displayName eq 'xxx-sp'"

Open satyajitkoijam opened this issue 3 years ago • 4 comments

We are upgrading provider version from v1.5.0 to v2.0 and above but got below error │ Error: Listing service principals for filter "displayName eq 'xxx-sp'"││ with data.azuread_service_principal.xxx_sp, │ on data.tf line 10, in data "azuread_service_principal" "xxx_sp": │ 10: data "azuread_service_principal" "xxx_sp" {

Service principal which is used to run the terraform code have below permission

Azure Active Directory Graph (3)

  • Application.ReadWrite.All | Application |
  • Application.ReadWrite.OwnedBy | Application |
  • Directory.Read.All | Application |

Microsoft Graph (8)

  • Application.ReadWrite.All | Delegated |
  • Application.ReadWrite.All | Application | 
  • Application.ReadWrite.OwnedBy | Application |  
  • Directory.Read.All | Application | 
  • Directory.ReadWrite.All | Delegated | 
  • Directory.ReadWrite.All | Application |  
  • Group.ReadWrite.All | Application | 
  • GroupMember.ReadWrite.All| Application |

satyajitkoijam avatar Nov 11 '22 07:11 satyajitkoijam

@satyajitkoijam Thanks for reporting this. We have test coverage for this data source which shows no regressions. In order for us to diagnose your issue further, please can you paste the entire error message as the one you have posted is truncated with the useful buts cut off, thanks!

manicminer avatar Nov 17 '22 08:11 manicminer

@manicminer , please find the error

Initializing the backend...

Successfully configured the backend "azurerm"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- Finding hashicorp/azurerm versions matching "~> 3.0"...
- Finding hashicorp/azuread versions matching "~> 2.0"...
- Using hashicorp/azurerm v3.24.0 from the shared cache directory
- Installing hashicorp/azuread v2.28.1...
- Installed hashicorp/azuread v2.28.1 (unauthenticated)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!
Downloading git::https://stash.org.co.uk/scm/azuredshared/lz-azure-shared?ref=v1.0.4 for naming_standard...
- naming_standard in .terraform/modules/naming_standard/azure-naming-standard-tfmodule
Downloading git::https://stash.org.co.uk/scm/azuredshared/lz-azure-shared?ref=v1.0.4 for role_assignment_abc...
- role_assignment_abc in .terraform/modules/role_assignment_abc/azure-roleassignment-tfmodule
╷
│ Error: Listing service principals for filter "displayName eq 'abc-sp'"
│ 
│   with data.azuread_service_principal.abc_sp,
│   on data.tf line 10, in data "azuread_service_principal" "abc_sp":
│   10: data "azuread_service_principal" "abc_sp" {
│ 
│ ServicePrincipalsClient.BaseClient.Get(): Get
│ "https://graph.microsoft.com/beta/446a/servicePrincipals?%24filter=displayName+eq+%27abc-sp%27":
│ http: RoundTripper implementation (*retryablehttp.RoundTripper) returned a
│ nil *Response with a nil error
╵
make: *** [plan] Error 1
[Pipeline] sh
+ echo Pipeline Build Failed

satyajitkoijam avatar Nov 18 '22 07:11 satyajitkoijam

@satyajitkoijam This looks like a network error, but to be more sure, please can you enable debug logging and post the full output in a linked gist? We don't currently retry this specific error condition but that is an improvement we will be adding to the provider in the near future. Thanks!

manicminer avatar Nov 18 '22 10:11 manicminer

Any update on this issue?

jeromejoseBAG avatar Jun 20 '25 13:06 jeromejoseBAG