Activating or deactivating an MFA policy
Activating an MFA policy
To activate an inactive MFA policy:
- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Security settings. - Navigate to the MFA policies tab.
- In the MFA policy list, click
in the policy row and select Activate. - In the window that opens, confirm the operation.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
-
See the description of the CLI command for activating an MFA policy:
yc organization-manager mfa-enforcement activate --help -
To activate an MFA policy, run this command:
yc organization-manager mfa-enforcement activate \ --id <policy_ID>Where
--idis the ID of the MFA policy you need to activate.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
-
Open the Terraform configuration file and update the
statusparameter in theyandex_organizationmanager_mfa_enforcementresource:resource "yandex_organizationmanager_mfa_enforcement" "example_mfa_policy" { name = "<policy_name>" organization_id = "<organization_ID>" acr_id = "<authentication_factor_type>" ttl = "<lifetime>" status = "MFA_ENFORCEMENT_STATUS_ACTIVE" apply_at = "<activation_time>" enroll_window = "<creation_deadline>" description = "<policy_description>" }Where
statusis the policy status:MFA_ENFORCEMENT_STATUS_ACTIVEto activate the policy. This is an optional setting.For more information about the
yandex_organizationmanager_mfa_enforcementproperties, see this provider guide. -
Apply the changes:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will activate the MFA policy. You can check the MFA policy update using the Cloud Center UI
or this CLI command:yc organization-manager mfa-enforcement get <policy_ID> -
Use the Activate REST API method for the MfaEnforcement resource or the MfaEnforcementService/Activate gRPC API call.
As a result, the MFA policy will be activated and switch to the Active status, and users with accounts added to the policy's target groups will be required to use an additional authentication factor.
Deactivating an MFA policy
To temporarily deactivate an MFA policy:
- Log in to Yandex Identity Hub
. - In the left-hand panel, select
Security settings. - Navigate to the MFA policies tab.
- In the MFA policy list, click
in the policy row and select Suspend. - In the window that opens, confirm the operation.
-
See the description of the CLI command for deactivating an MFA policy:
yc organization-manager mfa-enforcement deactivate --help -
To deactivate an MFA policy, run this command:
yc organization-manager mfa-enforcement deactivate \ --id <policy_ID>Where
--idis the ID of the MFA policy you need to deactivate.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
-
Open the Terraform configuration file and update the
statusparameter in theyandex_organizationmanager_mfa_enforcementresource:resource "yandex_organizationmanager_mfa_enforcement" "example_mfa_policy" { name = "<policy_name>" organization_id = "<organization_ID>" acr_id = "<authentication_factor_type>" ttl = "<lifetime>" status = "MFA_ENFORCEMENT_STATUS_INACTIVE" apply_at = "<activation_time>" enroll_window = "<creation_deadline>" description = "<policy_description>" }Where
statusis the policy status:MFA_ENFORCEMENT_STATUS_INACTIVEto deactivate the policy. This is an optional setting.For more information about the
yandex_organizationmanager_mfa_enforcementproperties, see this provider guide. -
Apply the changes:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will deactivate the MFA policy. You can check the MFA policy update using the Cloud Center UI
or this CLI command:yc organization-manager mfa-enforcement get <policy_ID> -
Use the Deactivate REST API method for the MfaEnforcement resource or the MfaEnforcementService/Deactivate gRPC API call.
As a result, the MFA policy will be deactivated and switch to the Inactive status, while users whose accounts belong to the policy's target groups will no longer be required to use an additional authentication factor.
If you need to temporarily exclude specific users or groups from the policy without deactivating it completely, use MFA policy exceptions.