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 installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.
-
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 parameter.For more information about
yandex_organizationmanager_mfa_enforcementproperties, see this provider guide. -
Apply the changes:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the 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 parameter.For more information about
yandex_organizationmanager_mfa_enforcementproperties, see this provider guide. -
Apply the changes:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the 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.