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

InvalidResourceType when creating new RBAC assignment using SDK #17071

Closed
DamirZelenic opened this issue Feb 15, 2022 · 6 comments
Closed

InvalidResourceType when creating new RBAC assignment using SDK #17071

DamirZelenic opened this issue Feb 15, 2022 · 6 comments
Assignees
Labels
Authorization customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@DamirZelenic
Copy link

Bug Report

  • import path of package in question
    github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization"

  • SDK version e.g. master, latest, 18.1.0
    v0.3.0

  • output of go version
    go version go1.17.6 darwin/arm64

  • What happened?
    When trying to create new RBAC role assignment using Create method I got:
RESPONSE 404: 404 Not Found
ERROR CODE: InvalidResourceType
{
  "error": {
    "code": "InvalidResourceType",
    "message": "The resource type 'roleAssignments' could not be found in the namespace 'Microsoft.Authorization' for api version '2020-10-01-preview'. The supported api-versions are '2014-04-01-preview,2014-07-01-preview,2014-10-01-preview,2015-05-01-preview,2015-06-01,2015-07-01,2016-07-01,2017-05-01,2017-09-01,2017-10-01-preview,2018-01-01-preview,2018-07-01,2018-09-01-preview,2018-12-01-preview,2019-04-01-preview,2020-03-01-preview,2020-04-01-preview,2020-08-01-preview,2021-04-01-preview'."
  }
}
  • What did you expect or want to happen?
    Expect result like:
2022/02/15 11:45:19 Response result: armauthorization.RoleAssignmentsClientCreateResult{RoleAssignment:armauthorization.RoleAssignment{Properties:(*armauthorization.RoleAssignmentProperties)(0x14000202120), ID:(*string)(0x14000552710), Name:(*string)(0x14000552730), Type:(*string)(0x14000552720)}}

As error suggests there is unsupported api version in
azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization@v0.3.0/zz_generated_roleassignments_client.go

line 87:

reqQP.Set("api-version", "2020-10-01-preview")

changing it to supported version, for example:

reqQP.Set("api-version", "2020-08-01-preview")

produces expected result.

  • How can we reproduce it?
rbacClient := armauthorization.NewRoleAssignmentsClient(subscriptionID, cred, nil)
	rbacres, err := rbacClient.Create(ctx,
		scope,
		uuid, //"<role-assignment-name>" must be unique
		armauthorization.RoleAssignmentCreateParameters{
			Properties: &armauthorization.RoleAssignmentProperties{
				PrincipalID:      to.StringPtr(principalID),
				PrincipalType:    armauthorization.PrincipalType("User").ToPtr(),
				RoleDefinitionID: to.StringPtr(roleDefID),
			},
		},
		nil)
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 15, 2022
@jhendrixMSFT jhendrixMSFT added the Mgmt This issue is related to a management-plane library. label Feb 15, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Feb 15, 2022
@lirenhe lirenhe assigned ArcturusZhang and unassigned lirenhe Feb 16, 2022
@ArcturusZhang
Copy link
Member

ArcturusZhang commented Feb 16, 2022

Hi @DamirZelenic thanks for this issue and sorry for the inconvenience!

We will confirm this with the corresponding service team to see if this api-version has been deployed to all the regions. Stay tuned.
As a workaround, we could downgrade the api-version in this package to 2020-08-01-preview to ensure everything could work properly here.

Also could you please also share the location/region (if any) and cloud you are using when deploying the role assignment?

@ArcturusZhang ArcturusZhang added Authorization Service Attention Workflow: This issue is responsible by Azure service team. labels Feb 16, 2022
@ghost
Copy link

ghost commented Feb 16, 2022

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @darshanhs90, @AshishGargMicrosoft.

Issue Details

Bug Report

  • import path of package in question
    github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization"

  • SDK version e.g. master, latest, 18.1.0
    v0.3.0

  • output of go version
    go version go1.17.6 darwin/arm64

  • What happened?
    When trying to create new RBAC role assignment using Create method I got:
RESPONSE 404: 404 Not Found
ERROR CODE: InvalidResourceType
{
  "error": {
    "code": "InvalidResourceType",
    "message": "The resource type 'roleAssignments' could not be found in the namespace 'Microsoft.Authorization' for api version '2020-10-01-preview'. The supported api-versions are '2014-04-01-preview,2014-07-01-preview,2014-10-01-preview,2015-05-01-preview,2015-06-01,2015-07-01,2016-07-01,2017-05-01,2017-09-01,2017-10-01-preview,2018-01-01-preview,2018-07-01,2018-09-01-preview,2018-12-01-preview,2019-04-01-preview,2020-03-01-preview,2020-04-01-preview,2020-08-01-preview,2021-04-01-preview'."
  }
}
  • What did you expect or want to happen?
    Expect result like:
2022/02/15 11:45:19 Response result: armauthorization.RoleAssignmentsClientCreateResult{RoleAssignment:armauthorization.RoleAssignment{Properties:(*armauthorization.RoleAssignmentProperties)(0x14000202120), ID:(*string)(0x14000552710), Name:(*string)(0x14000552730), Type:(*string)(0x14000552720)}}

As error suggests there is unsupported api version in
azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization@v0.3.0/zz_generated_roleassignments_client.go

line 87:

reqQP.Set("api-version", "2020-10-01-preview")

changing it to supported version, for example:

reqQP.Set("api-version", "2020-08-01-preview")

produces expected result.

  • How can we reproduce it?
rbacClient := armauthorization.NewRoleAssignmentsClient(subscriptionID, cred, nil)
	rbacres, err := rbacClient.Create(ctx,
		scope,
		uuid, //"<role-assignment-name>" must be unique
		armauthorization.RoleAssignmentCreateParameters{
			Properties: &armauthorization.RoleAssignmentProperties{
				PrincipalID:      to.StringPtr(principalID),
				PrincipalType:    armauthorization.PrincipalType("User").ToPtr(),
				RoleDefinitionID: to.StringPtr(roleDefID),
			},
		},
		nil)
Author: DamirZelenic
Assignees: ArcturusZhang
Labels:

question, Authorization, Service Attention, Mgmt, customer-reported

Milestone: -

@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Feb 16, 2022
@ArcturusZhang ArcturusZhang added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Feb 16, 2022
@DamirZelenic
Copy link
Author

DamirZelenic commented Feb 16, 2022

Hi @ArcturusZhang
It is default AzureCloud. Subscription and RBAC assignment doesn't have any specific region?
Subscription location placement id:

"LocationPlacementId": "Public_2014-09-01"

In error message I see newer api being available "...2020-08-01-preview,2021-04-01-preview", only 10-01 is missing.
I can share Role Assignment Id if needed.

@ghost ghost removed the needs-author-feedback Workflow: More information is needed from author to address the issue. label Feb 16, 2022
@ArcturusZhang
Copy link
Member

Hi @ArcturusZhang It is default AzureCloud. Subscription and RBAC assignment doesn't have any specific region? Subscription location placement id:

"LocationPlacementId": "Public_2014-09-01"

In error message I see newer api being available "...2020-08-01-preview,2021-04-01-preview", only 10-01 is missing. I can share Role Assignment Id if needed.

Please share that as well if possible. Thank you!

@tadelesh tadelesh added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Dec 26, 2023
@tadelesh tadelesh assigned raych1 and unassigned ArcturusZhang Dec 26, 2023
@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Dec 26, 2023
Copy link

Hi @DamirZelenic. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

Copy link

github-actions bot commented Jan 2, 2024

Hi @DamirZelenic, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@github-actions github-actions bot added the no-recent-activity There has been no recent activity on this issue. label Jan 2, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Authorization customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

6 participants