A Tenant ID is a value set by the system when a tenant record is created. Tenant ID values are not guaranteed to always be the same value for the same named tenant in two different databases. For example, if you dump and load, tenants may have different IDs after being reloaded. However, a tenant ID will never change during a session.
Developers should only use tenant IDs in their code when they are certain that it refers to the correct tenant. In situations where code needs to find a tenant record or that is verifying that the correct tenant is available, it is safer to use the tenant name, since the tenant name will not change.
Tenant records are stored in the _Tenant table. Tenant IDs have the following characteristics:
The tenant ID of the default tenant is always 0 (zero). There can be only one default tenant (an unnamed tenant).
Tenant IDs of regular tenants (named tenants) are always a positive number.
Tenant IDs of super tenants are always a negative number.