I created an azure webapp. For local git deployment, I created some deployment credentials.
I later deleted the webapp, and created a new one. It was nice that I could use the same app name as before. (I wouldn't like to permanently pollute the app namespace.)
I wanted to use the same deployment credentials, but Azure wouldn't let me - I had to make a slight change.
What you are referring to is known as User-Level or deployment credentials. These are tied to your account.
See this article to understand how User-level credentials work: User-level credentials (aka Deployment Credentials)
Snippet from above link
These are the credentials that you choose yourself in the Azure portal. If you're not sure what they are, you can reset them by going to the Dashboard tab for any site and clicking 'Reset deployment credentials' (under quick glance).
These credentials are directly tied to a Microsoft Account, and not to a particular web app. This needs to be emphasized, because the Azure portal UI is a bit confusing, as you need to go under a specific site on order to change them. But changing them under one site affects all of them!
Note that when an Azure subscription has multiple admins/co-admins, each person has their own set of credentials, since they each have a different Microsoft Account. The same is true for users that are given access to a Web App via RBAC (Role Based Access Control). In other words, user-level credentials are never meant to be shared among different users.
One key point about the user-level credentials is that since you specifically set them, they are meant to be memorized, and directly typed by the user when needed (e.g. when doing a git push).
The restriction with the UI is that there is no option to reset/retrieve the password. If you try to do anything with an existing username (Checks Globally in Azure) you will receive an error as shown below:
Only when you enter a name which has not been used earlier, the UI will allow you to proceed.
To answer your questions. The deployment credentials are deleted when you setup a different one. So if you forgot the password of your older deployment credentials, then you can change the username to something unique, and then again revert back to the older username.
However, if someone else chooses or already has chosen your username, then you cannot have it.
So the credentials are tied to your account, but their availability is on a global scale.