First, within Microsoft Teams, select the Teams icon in the left navigation. Then choose a Team or channel and select the 3 horizontal dots next to any team name. Once you click the icon, you'll see a popup with an option to Get link to team/channel. Choose this option.
Once you select 'Get a link to team/channel', select the Copy button. You can paste this link to any text editor. Included in the URL is the groupId and the tenantId for your Microsoft Teams account.
Once you have the link to your team, it will look similar to this:
https://teams.microsoft.com/l/channel/xxxxxxxxxxxxxxxxxf%40thread.tacv2/General?groupId=xxx-xxx-xxx-xxxx-xxxx&tenantId=xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
As you can see, your link to your Microsoft Teams url includes a groupId parameter. This groupId is your Microsoft Teams Team id for this channel.
If you are looking for your Microsoft Teams Tenant ID which is essentially your Account ID, you can grab this value in the tenantId value as well.