Detach an authorization policy from a user (DetachPolicyFromUser)

Last Updated: Nov 10, 2017

Interface description

Detaches a specified authorization policy from a user.

Request parameters

Action

  • Type: String
  • Required: Yes
  • Description: Required. The parameter value is “DetachPolicyFromUser”.

PolicyType

  • Type: String
  • Required: Yes
  • Description: Authorization policy type. Value: “System” or “Custom”.

PolicyName

  • Type: String
  • Required: Yes
  • Description: Authorization policy name.

UserName

  • Type: String
  • Required: Yes
  • Description: User name. Example: zhangqiang

Return parameters

Only public parameters are returned. For details, see Public return parameters.

Required permissions

Action

ram:DetachPolicyFromUser

Resource

acs:ram:*:${AccountId}:user/${UserName}

acs:ram:*:${AccountId} or system:policy/${PolicyName}

Error messages

InvalidParameter.PolicyType
  • HTTP Status: 400
  • Error Message: The parameter - “PolicyType” is incorrect.
InvalidParameter.UserName.InvalidChars
  • HTTP Status: 400
  • Error Message: The parameter - “UserName” contains invalid chars.
InvalidParameter.UserName.Length
  • HTTP Status: 400
  • Error Message: The parameter - “UserName” beyond the length limit.
EntityNotExist.User
  • HTTP Status: 404
  • Error Message: The user does not exist.
InvalidParameter.PolicyName.InvalidChars
  • HTTP Status: 400
  • Error Message: The parameter - “PolicyNam” contains invalid chars.
InvalidParameter.PolicyName.Length
  • HTTP Status: 400
  • Error Message: The parameter - “PolicyName” beyond the length limit.
EntityNotExist.Policy
  • HTTP Status: 404
  • Error Message: The policy does not exist.
EntityNotExist.User.Policy
  • HTTP Status: 404
  • Error Message: The indicate policy of the user does not exist.

Operation examples

Request example

  1. https://ram.aliyuncs.com/?Action=DetachPolicyFromUser
  2. &PolicyType=Custom
  3. &PolicyName=OSS-Administrator
  4. &UserName=zhangqiang
  5. &<Public request parameters>

Return example

XML format

  1. <DetachPolicyFromUserResponse>
  2. <RequestId>697852FB-50D7-44D9-9774-530C31EAC572</RequestId>
  3. </DetachPolicyFromUserResponse>

JSON format

  1. {
  2. "RequestId": "697852FB-50D7-44D9-9774-530C31EAC572"
  3. }
Thank you! We've received your feedback.