You can refer to documentation - How to: Sign in any Azure Active Directory user using the multi-tenant application pattern to create a multi-tenant app. Basically, you need to make the following changes achieve the same -
- Update you application registration to be multi-tenant.
- Modify your code to use the /common endpoint and to handle multiple issuer values
- User/Admin consent to create a service principal in the user's tenant and make few code changes for the same.
The above documentation provide detailed steps to create a multi-tenant app.
You can also refer to the sample app here.