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 Identity and Access Management
    • All guides
    • Handling secrets that are available in the public domain
      • Creating a service account
      • Updating a service account
      • Assigning roles to a service account
      • Setting up service account access permissions
      • Getting information about a service account
      • Getting an ID token for a service account
      • Deleting a service account
  • Secure use of Yandex Cloud
  • Access management
  • Pricing policy
  • Role reference
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. Service accounts
  3. Deleting a service account

Deleting a service account

Written by
Yandex Cloud
Updated at May 5, 2025

Warning

Deleting a service account is permanent. You cannot restore a deleted service account; you can only re-create it.

Management console
CLI
Terraform
API
  1. In the management console, navigate to the folder the service account belongs to.
  2. In the list of services, select Identity and Access Management.
  3. In the left-hand panel, select Service accounts.
  4. In the row with the service account you need, click and select Delete.
  5. In the window that opens, click Delete.

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. See the description of the delete service account command:

    yc iam service-account delete --help
    
  2. Select a service account, e.g., my-robot:

    yc iam service-account list
    

    Result:

    +----------------------+------------------+-------------------------------+
    |          ID          |       NAME       |          DESCRIPTION          |
    +----------------------+------------------+-------------------------------+
    | aje6o61dvog2******** | my-robot         |                               |
    | aje9sda1ufvq******** | account_name     | account_description           |
    +----------------------+------------------+-------------------------------+
    
  3. Delete the service account:

    yc iam service-account delete my-robot
    

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

To delete a service account:

  1. Open the Terraform configuration file and delete the fragment with the service account description.
    Example of the service account description in the Terraform configuration:

    ...
    resource "yandex_iam_service_account" "sa" {
      name        = "my-robot"
      description = "this is my favorite service account"
     }
    ...
    
  2. In the command line, go to the directory with the Terraform configuration file.

  3. Check the configuration using this command:

    terraform validate
    

    If the configuration is correct, you will get this message:

    Success! The configuration is valid.
    
  4. Run this command:

    terraform plan
    

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

  5. Apply the configuration changes:

    terraform apply
    
  6. Confirm the changes: type yes into the terminal and press Enter.

    You can check the deletion of the service account using the management console or this CLI command:

    yc iam service-account list
    

To delete a service account, use the delete REST API method for the ServiceAccount resource or the ServiceAccountService/Delete gRPC API call.

You cannot delete a service account while it is linked to some cloud resources. First, update the service account in the resource's settings or delete the resource and then delete the service account. For example, if your service account is linked to a VM, first delete the VM and then delete the service account.

Was the article helpful?

Previous
Getting an ID token for a service account
Next
Assigning roles
Yandex project
© 2025 Yandex.Cloud LLC