Skip to content
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

Unable to create role assignment at resource provider scopeof /providers/Microsoft.Marketplace #18387

Closed
1 task done
ggomes-agc opened this issue Sep 14, 2022 · 4 comments · Fixed by #22398
Closed
1 task done

Comments

@ggomes-agc
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.2.9

AzureRM Provider Version

3.22.0

Affected Resource(s)/Data Source(s)

azurerm_role_assignment

Terraform Configuration Files

resource "azurerm_role_assignment" "assignment-2" {
  scope              = "/providers/Microsoft.Marketplace"
  role_definition_id = "/providers/Microsoft.Authorization/roleDefinitions/dd920d6d-f481-47f1-b461-f338c46b2d9f"
  principal_id       = azuread_service_principal.spn.id
}

Debug Output/Panic Output

Error: expected scope to be one of [/providers/Microsoft.Subscription], got /providers/Microsoft.Marketplace

  on main.tf line 73, in resource "azurerm_role_assignment" "assignment-2":
  73:   scope              = "/providers/Microsoft.Marketplace"



Error: ID was missing the `enrollmentAccounts` element

  on main.tf line 73, in resource "azurerm_role_assignment" "assignment-2":
  73:   scope              = "/providers/Microsoft.Marketplace"



Error: parsing "/providers/Microsoft.Marketplace": expected 4 segments within the Resource ID but got 2 for "/providers/Microsoft.Marketplace"

  on main.tf line 73, in resource "azurerm_role_assignment" "assignment-2":
  73:   scope              = "/providers/Microsoft.Marketplace"



Error: parsing "/providers/Microsoft.Marketplace": parsing segment "subscriptions": expected the segment "providers" to be "subscriptions"

  on main.tf line 73, in resource "azurerm_role_assignment" "assignment-2":
  73:   scope              = "/providers/Microsoft.Marketplace"



Error: parsing "/providers/Microsoft.Marketplace": expected 4 segments within the Resource ID but got 2 for "/providers/Microsoft.Marketplace"

  on main.tf line 73, in resource "azurerm_role_assignment" "assignment-2":
  73:   scope              = "/providers/Microsoft.Marketplace"



Error: Can not parse "scope" as a resource id: No subscription ID found in: "providers/Microsoft.Marketplace"

  on main.tf line 73, in resource "azurerm_role_assignment" "assignment-2":
  73:   scope              = "/providers/Microsoft.Marketplace"


ERRO[0005] 1 error occurred:
        * exit status 1

Expected Behaviour

The role assignment should be created. The following Powershell code is able to deploy the role assignment.

New-AzRoleAssignment -ObjectId $sp.Id -Scope /providers/Microsoft.Marketplace -RoleDefinitionName "Marketplace Admin"

Note: This issue is similar to the fix for #17397.

Actual Behaviour

Terraform's syntax checking seems to block this scope type.

Steps to Reproduce

terraform plan

Important Factoids

No response

References

No response

@ms-zhenhua
Copy link
Contributor

Hi @ggomes-agc, thank you for reporting this issue. I will create a PR to support /providers/Microsoft.Marketplace

@rcskosir
Copy link
Contributor

rcskosir commented Jun 2, 2023

Hi @ms-zhenhua I followed the thread of #18439 and saw that it was closed and you referenced opening a new PR, but that one was not linked. I am following up to see if you know if this issue has been fixed/resolved. Thank you!

@ms-zhenhua
Copy link
Contributor

ms-zhenhua commented Jun 4, 2023

Hi @rcskosir, I have submitted a new PR to resolve this issue.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.