Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Command line interface
  • Getting started
    • All guides
    • Installation
    • Updates
    • Deletion
    • Working with command versions
      • Yandex account
      • Service account
      • Federated user
      • Local user
      • IAM token from an environment variable
      • Without a GUI and browser
  • Releases
  • Troubleshooting

In this article:

  • Getting started
  • Authenticate with an IAM token
  • Delete the IAM token from the environment variable
  1. Step-by-step guides
  2. Authentication
  3. IAM token from an environment variable

Authenticating in the Yandex Cloud CLI with an IAM token from an environment variable

Written by
Yandex Cloud
Updated at August 19, 2026
View in Markdown
  • Getting started
  • Authenticate with an IAM token
  • Delete the IAM token from the environment variable

An IAM token is a unique sequence of characters used for authentication in Yandex Cloud that verifies the identity of a user or service account. IAM tokens are valid for a maximum of 12 hours.

Authentication with an IAM token from the YC_IAM_TOKEN environment variable is a convenient option for scripts, CI/CD workflows, automated tests, containers, and temporary runtime environments where it is impractical to use interactive authentication or store credentials in the CLI profile. For automation, use the IAM token of a service account that has the required roles. Configure a mechanism to issue a new IAM token before the current token expires.

Warning

Do not use the IAM token in source code or write it to logs. For CI/CD workflows, store the token in a secure secret vault.

If a token is compromised or no longer required, revoke it.

Getting startedGetting started

  1. Install the Yandex Cloud CLI.

  2. Get an IAM token.

    • Yandex account
    • Service account
    • Federated account
    • Local user account

Authenticate with an IAM tokenAuthenticate with an IAM token

  1. Add your IAM token to the YC_IAM_TOKEN environment variable:

    macOS/Linux
    Windows (PowerShell)
    export YC_IAM_TOKEN="<IAM_token>"
    
    $env:YC_IAM_TOKEN = "<IAM_token>"
    

    The variable will be available in the current shell session and its child processes.

    Warning

    The value from the YC_IAM_TOKEN environment variable overrides the authentication credentials specified in the CLI profile.

  2. Run a CLI command, e.g., to get a list of VMs within a folder:

    yc compute instance list
    

Delete the IAM token from the environment variableDelete the IAM token from the environment variable

To enable the CLI to use the profile credentials again, delete the YC_IAM_TOKEN environment variable:

macOS/Linux
Windows (PowerShell)
unset YC_IAM_TOKEN
Remove-Item Env:YC_IAM_TOKEN

Warning

Deleting the environment variable does not invalidate the IAM token.

Useful linksUseful links

  • IAM token

  • Getting an IAM token for a Yandex account

  • Getting an IAM token for a service account

  • Getting an IAM token for a federated account

  • Getting an IAM token for a local user account

  • Revoking an IAM token

  • Authentication in the Yandex Cloud CLI with a Yandex account

  • Authenticating in the Yandex Cloud CLI as a service account

  • Authenticating with the Yandex Cloud CLI as a federated user

  • Authenticating in the Yandex Cloud CLI as a local user

  • Authenticating with the Yandex Cloud CLI on a server with no GUI

  • Yandex Cloud CLI troubleshooting

Was the article helpful?

Previous
Local user
Next
Without a GUI and browser
© 2026 Direct Cursus Technology L.L.C.