Replies: 1 comment 1 reply
-
|
This is a common pain point when integrating the ATK CLI into CI/CD pipelines. The Option 1: Use Azure Service Principal AuthenticationThe officially documented approach for CI/CD pipelines is to authenticate using Secret-based: npx atk auth login azure \
--username $AZURE_SERVICE_PRINCIPAL_CLIENT_ID \
--service-principal true \
--tenant $AZURE_TENANT_ID \
--password $AZURE_SERVICE_PRINCIPAL_CLIENT_SECRET \
--interactive falseCertificate-based: npx atk auth login azure \
--username $AZURE_SERVICE_PRINCIPAL_CLIENT_ID \
--service-principal true \
--tenant $AZURE_TENANT_ID \
--password cert.pem \
--interactive falseThis is documented in the CI/CD templates guide. Important caveat: Service principal auth works for Azure-scoped operations ( Option 2: Validate Without M365 AuthenticationFor your specific use case ( The
For CI/CD, try running schema validation first: npx atk validate --manifest-file ./appPackage/manifest.json --interactive falseIf you need environment variable substitution, use the npx atk validate --manifest-file ./appPackage/manifest.json \
--env-file ./.env.production \
--interactive falseOption 3: Offline Schema Validation (No ATK CLI Required)If your goal is purely to validate the manifest structure as part of CI/CD quality gates, you can skip the ATK CLI entirely and validate your For example, using npm install -g ajv-cli ajv-formats
# Download the schema (or pin it in your repo)
curl -o teams-schema.json \
https://raw.githubusercontent.com/OfficeDev/microsoft-teams-app-schema/main/MicrosoftTeams.schema.json
# Unzip your app package and validate
unzip -o appPackage.zip -d appPackage_extracted
ajv validate -s teams-schema.json -d appPackage_extracted/manifest.json --all-errorsThis runs entirely offline with no authentication and is well-suited for fast CI checks. Summary / RecommendationFor your CI/CD pipeline doing
I would recommend starting with Option 2 or Option 3 if your primary goal is manifest/package validation in CI/CD. These do not require any M365 authentication. If you need deeper validation rules that require an authenticated session, Option 1 with service principal is the officially supported CI/CD path, though it is limited to Azure-scoped operations today. References |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to set up a CI/CD configuration for a Teams app I've been working on, and I want to be able to validate the app package in the pipeline by using
atk validate --package-file appPackage.zip. The catch is that this command only works when I'm logged in to a m365 account (it doesn't work if I useatk auth login azureto log in), but when I try logging in to m365, it prompts me with an URL to confirm the credentials, which can't be done when inside the pipelines.I've looked everywhere for an answer and it seems to me that this is not possible. The documentation doesn't say anything about this specificaly and when I run
atk auth login m365 --helpthese are the only options I get:Can anyone confirm if that's the case and if I have any other option, please? If it is not possible I'll just leave it for now.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions