添加存储帐户的角色分配时 我使用用户分配的托管身份
RoleAssignmentCreateOrUpdateContent roleData = new RoleAssignmentCreateOrUpdateContent(
roleDefinitionId: new ResourceIdentifier(string.Concat("/subscriptions/", SubscriptionId, "/providers/Microsoft.Authorization/roleDefinitions/", roleId)),
principalId: PrincipalId);
但我收到错误
ERROR: {"error":{"code":"PrincipalNotFound","message":"Principal xxx does not exist in the directory xxx. Check that you have the correct principal ID. If you are creating this principal and then immediately assigning a role, this error might be related to a replication delay. In this case, set the role assignment principalType property to a value, such as ServicePrincipal, User, or Group. See https://aka.ms/docs-principaltype"}}
建议添加principaltype,用户分配的托管身份、用户或组或serviceprincipal的主体类型是什么
托管身份使用服务主体,因此您应该将主体类型设置为“ServicePrincipal”。