Managing registry passwords
For devices and registries to begin exchanging data and commands, you need to log in. This section describes how to manage registry passwords for the appropriate authorization method.
Note
When using an X.509 certificate along with a password, the password has higher priority.
Adding a password to a registry
You can add a password to an already created registry or set it when creating a registry using the --password
parameter.
Note
You can also set a password from the input stream. To do this, use the --read-password
flag instead of the --password
parameter.
Adding a password to an existing registry
To add a password to an existing registry:
- In the management console
, select the folder where you want to ad a password for an existing registry. - Select IoT Core.
- Select the required registry from the list.
- Under Passwords, click Add password.
- In the Password field, enter the password you will use to access the registry.
To create a password, you can use the password generator .
Make sure to save your password, as you will need it later. - Click Add.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
To add a password:
-
Get a list of registries in the folder:
yc iot registry list
Result:
+----------------------+-------------------+ | ID | NAME | +----------------------+-------------------+ | arenou2oj4ct******** | my-registry | +----------------------+-------------------+
-
Add a password to the registry:
yc iot registry password add --registry-name my-registry --password Passw0rdForRegistry
Result:
registry_id: arenou2oj4ct******** id: areuu2hgsv6k******** created_at: "2019-12-16T15:32:46.655139Z"
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To add a password to a registry created using Terraform:
-
In the configuration file, describe the parameters of the resources you want to create:
yandex_iot_core_registry
: Registry parameters:name
: Registry name.description
: Registry description.passwords
: List of registry passwords for authorization with a username and password.
Here is an example of the resource structure in the configuration file:
resource "yandex_iot_core_registry" "my_registry" { name = "test-registry" description = "test registry for terraform provider documentation" ... passwords = [ "<password_1>", "<password_2>" ] ... }
For more information about the
yandex_iot_core_registry
resource parameters in Terraform, see the relevant provider documentation . -
In the command line, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
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.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can verify registry passwords using the management console
or this CLI command:yc iot registry password list --registry-name <registry_name>
To add a password to a registry, use the addPassword REST API method for the Registry resource or the RegistryService/AddPassword gRPC API call.
Setting a password for a registry when creating it
For information about how to set a password for a registry when creating it, see Creating a registry.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
Create a registry with a password:
yc iot registry create --name registry-with-pass --password Passw0rdForDevice
Result:
done (1s)
id: areg96c8loru********
folder_id: b1g88tflru0e********
created_at: "2019-12-16T15:34:25.563Z"
name: registry-with-pass
status: ACTIVE
log_group_id: ckghhil3b5o9********
For information about how to set a password for a registry when creating it, see Creating a registry.
To set a password for a registry when creating it, use the create REST API method for the Registry resource or the RegistryService/Create gRPC API call.
Getting a list of registry passwords
To view the list of registry passwords:
- In the management console
, select the folder to get the list of registry passwords for. - Select IoT Core.
- Select the required registry from the list.
- On the Overview page, go to the Passwords section.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To get a list of passwords:
-
Get a list of registries in the folder:
yc iot registry list
Result:
+----------------------+--------------------+ | ID | NAME | +----------------------+--------------------+ | areg96c8loru******** | registry-with-pass | | arenou2oj4ct******** | my-registry | +----------------------+--------------------+
-
Get a list of registry passwords:
yc iot registry password list --registry-name registry-with-pass
Result:
+----------------------+---------------------+ | ID | CREATED AT | +----------------------+---------------------+ | are0gffs957e******** | 2019-12-16 15:34:25 | +----------------------+---------------------+
To get a list of registry passwords, use the listPasswords REST API method for the Registry resource or the RegistryService/ListPasswords gRPC API call.
Deleting a registry password
To delete a registry password:
- In the management console
, select the folder to delete the registry password from. - Select IoT Core.
- Select the required registry from the list.
- In the row with the password, click
and select Delete from the drop-down list. - In the window that opens, click Delete.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To delete a password:
-
Get a list of registry passwords:
yc iot registry password list --registry-name registry-with-pass
Result:
+----------------------+---------------------+ | ID | CREATED AT | +----------------------+---------------------+ | are0gffs957e******** | 2019-12-16 15:34:25 | +----------------------+---------------------+
-
Delete the password:
yc iot registry password delete --registry-name registry-with-pass --password-id are0gffs957e********
-
Make sure that the password was deleted:
yc iot registry password list --registry-name registry-with-pass
Result:
+----+------------+ | ID | CREATED AT | +----+------------+ +----+------------+
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To delete the password of a registry created using Terraform:
-
Open the Terraform configuration file and delete the password value in the
passwords
section, in the registry description fragment. To delete all passwords, delete the entirepasswords
section.Example registry description in the Terraform configuration:
resource "yandex_iot_core_registry" "my_registry" { name = "test-registry" description = "test registry for terraform provider documentation" ... passwords = [ "<password_1>", "<password_2>" ] ... }
For more information about the
yandex_iot_core_registry
resource parameters in Terraform, see the relevant provider documentation . -
In the command line, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validate
If the configuration is correct, you will get this message:
Success! The configuration is valid.
-
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.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
into the terminal and press Enter.You can verify registry passwords using the management console
or this CLI command:yc iot registry password list --registry-name <registry_name>
To delete a registry password, use the deletePassword REST API method for the Registry resource or the RegistryService/DeletePassword gRPC API call.