ALTER EXTERNAL CONSUMER … REMOVE PROGRAMMATIC ACCESS TOKEN (PAT)¶
Revokes a Programmatic Access Token (PAT) from an external consumer. Once removed, the token can no longer be used to authenticate.
Syntax¶
Parameters¶
IF EXISTSFor the external consumer: applies the change only if the consumer exists.
For the token: removes the token only if a token with the specified name exists. If no token with that name exists, the command does nothing and completes successfully instead of returning an error.
nameSpecifies the identifier for the external consumer.
REMOVE { PROGRAMMATIC ACCESS TOKEN | PAT } token_nameRevokes the programmatic access token with the specified name.
PATis an alias forPROGRAMMATIC ACCESS TOKEN.
Access control requirements¶
A role used to execute this operation must have the following privileges at a minimum:
| Privilege | Object | Notes |
|---|---|---|
| OWNERSHIP | External Consumer | Required to remove a PAT from the external consumer. |
For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.
For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
Usage notes¶
- Revoked tokens cannot be recovered. You must generate a new token using ALTER EXTERNAL CONSUMER … ADD PAT.
- Removing a token immediately revokes the external consumer’s ability to authenticate using that token.
Examples¶
Remove a PAT from an external consumer:
Remove a PAT if it exists: