What is your version of Teams client?
Could you try to follow these steps to see if it works for you?
1)Click "Format" icon in Teams text.
2)Select "Code snippet"to insert your code.
3)After we send the code and we can copy the IP address from it normally
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.