This issue took a lot of time to work out due to lack of resources online. We ran in to an issue with trying to login to SharePoint and add a solution to the app catalogue. Due to 2FA we can’t just use a user name and password.
This is the code that worked for me within the pipeline to connect to the App Catalog
m365 login --authType certificate --certificateBase64Encoded $(O365Login) --thumbprint ${thumbprint} --tenant "${tenantID}" --appId "${appid}"
$(o365Login) is the Variable group name set up in the library section of the repository
${thumbprint} is the thumbprint of the certificate hosted in Azure
${tenantID} is obviously the tenant ID which can be obtained from Azure in the Azure Active Directory page
${appid} the application ID that would have been registered in Azure Active Directory,