Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Container Registry
  • Getting started
    • All guides
    • Installing and configuring Docker
    • Authentication in Container Registry
    • Scanning Docker images for vulnerabilities
    • Creating a trigger for a registry
      • Assigning a role
      • Viewing assigned roles
      • Revoking a role
  • Yandex Container Solution
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Troubleshooting
  • FAQ
  1. Step-by-step guides
  2. Working with roles
  3. Revoking a role

Revoking a role for a resource

Written by
Yandex Cloud
Updated at May 5, 2025

You can prevent a subject from accessing a resource. To do this, revoke the subject's roles for that resource or the resources that the access rights are inherited from. For more information, see How access management works in Yandex Cloud.

Management console
CLI
Terraform
API
  1. In the management console, select the folder where you want to revoke a role for a resource.
  2. In the list of services, select Container Registry.
  3. Select a registry or repository in it.
  4. Go to the Access bindings tab.
  5. Select a user from the list and click next to the username.
  6. Click Edit roles.
  7. Click next to the role to revoke.
  8. Click Save.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View assigned roles:

    yc container <resource> list-access-bindings <resource_name_or_ID>
    

    Where:

    • <resource>: registry or repository resource type.
    • <resource_name_or_ID>: Name or ID of the resource the role is assigned for.
  2. Revoke a role:

    • User:

      yc container <resource> remove-access-binding <resource_name_or_ID> \
        --role <role> \
        --user-account-id <user_ID>
      
    • Service account:

      yc container <resource> remove-access-binding <resource_name_or_ID> \
        --role <role> \
        --service-account-id <service_account_ID>
      
    • All authorized users (the All authenticated users public group):

      yc container <resource> remove-access-binding <resource_name_or_ID> \
        --role <role> \
        --all-authenticated-users
      

      Where:

      • <resource>: registry or repository resource type.
      • <resource_name_or_ID>: Name or ID of the resource you want to revoke the role for.
      • <role_ID>: Role you want to revoke.

    Example

    The example below revokes the container-registry.admin role for my-first-registry from a user.

    yc container registry remove-access-binding my-first-registry \
      --role container-registry.admin \
      --user-account-id ajeugsk5ubk6********
    

    Result:

    done (9s)
    

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

  1. Open the Terraform configuration file and delete the fragment with the role assignment description.

    Example role assignment description in the Terraform configuration:

    resource "yandex_container_registry_iam_binding" "registry_name" {
      registry_id = "<registry_ID>"
      role        = "<role>"
    
      members = [
        "userAccount:<user_ID>",
      ]
    }
    

    For more information about yandex_container_registry_iam_binding, see the provider documentation.

    1. In the terminal, change to the folder where you edited the configuration file.

    2. Make sure the configuration file is correct using the command:

      terraform validate
      

      If the configuration is correct, the following message is returned:

      Success! The configuration is valid.
      
    3. Run the command:

      terraform plan
      

      The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.

    4. Apply the configuration changes:

      terraform apply
      
    5. Confirm the changes: type yes in the terminal and press Enter.

You can check whether the role has been revoked using the management console or this CLI command:

  • Registry:

    yc container registry list-access-bindings <registry_name_or_ID>
    
  • Repository:

    yc container repository list-access-bindings <repository_name_or_ID>
    

View the roles assigned for resources.

To revoke registry roles, use the updateAccessBindings REST API method for the Registry resource or the RegistryService/UpdateAccessBindings gRPC API call.

To revoke repository roles, use the updateAccessBindings REST API method for the Repository resource or the RepositoryService/UpdateAccessBindings gRPC API call.

You can read more about role management in the Yandex Identity and Access Management documentation.

Was the article helpful?

Previous
Viewing assigned roles
Next
Yandex Container Solution
Yandex project
© 2025 Yandex.Cloud LLC