First, add your account in Xcode:
Go to Xcode → Settings → Accounts and sign in with your Apple ID
Then open your project → Signing & Capabilities
Enable Automatically manage signing
Select your Team from the dropdown
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: