Two-Factor Authentication (2FA) must be enabled for your Apple ID Developer Account. This article shows what needs to be done so you can set up the Two-Factor Authentication for Apple Developer Accounts.
When publishing an iOS app or rebuilding a Push Notification certificate you may be asked to provide your 2FA. The 2FA method validates a user's claimed identity by asking for a password and a second factor. It acts as another layer of security protection. A common example of a 2FA is a six-digit number generated from another authorized device.
Note: Since February 27, 2019 2FA is required for Account Holders of a developer program to sign in to their Apple Developer account and Certificates, Identifiers and Profiles"
- Apple Developer Account
Follow the instructions outlined in the Two Factor Authentication for Apple ID KB article in the "Set up two-factor authentication for your Apple ID" Section.
Your 2FA will be configured and you will be able to use it whenever requested. This way you will be able to publish your iOS app and/or rebuild your Push Notification Certificate