Teams Toolkit 中的 CI/CD 和 GitHub 操作

问题描述 投票:0回答:1

我在使用 GitHub CI CD 模板进行设置时遇到问题,尽管设置并确认了凭据,但目录中仍无法识别用户帐户。通过 M365 帐户的 GitHub 机密,我可以确认以下格式:

M365_ACCOUNT_NAME:“[电子邮件受保护]” M365_ACCOUNT_PASSWORD:“您的密码” M365_TENANT_ID:

# This is just an example workflow for continuous deployment.
# You should customize it to meet your own requirements.
name: 'Continuous Deployment'
on:
  # When new commits are pushed onto the main branch.
  push:
    branches:
      - main
jobs:
  buildAndPublish:
    runs-on: ubuntu-latest
    # You can uncomment the line below to use environments (refer to https://docs.github.com/en/actions/reference/environments). 
    environment: pkb-environment
    env:
      AZURE_ACCOUNT_NAME: ${{secrets.AZURE_ACCOUNT_NAME}}
      AZURE_ACCOUNT_PASSWORD: ${{secrets.AZURE_ACCOUNT_PASSWORD}}
      AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}}
      AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}}
      M365_ACCOUNT_NAME: ${{secrets.M365_ACCOUNT_NAME}}
      M365_ACCOUNT_PASSWORD: ${{secrets.M365_ACCOUNT_PASSWORD}}
      SECRET_BOT_PASSWORD: ${{secrets.SECRET_BOT_PASSWORD}}
      TEMAS_APP_UPDATE_TIME: ${{secrets.TEMAS_APP_UPDATE_TIME}}
      FUNCTION_APP_KEY: ${{secrets.FUNCTION_APP_KEY}}
      FUNCTION_APP_URL: ${{secrets.FUNCTION_APP_URL}}

      BOT_ID: ${{secrets.BOT_ID}}
      TEAMS_APP_ID: ${{secrets.TEAMS_APP_ID}}
      BOT_AZURE_APP_SERVICE_RESOURCE_ID: ${{ secrets.BOT_AZURE_APP_SERVICE_RESOURCE_ID}}
      BOT_DOMAIN: ${{secrets.BOT_DOMAIN}}
      TEAMS_APP_TENANT_ID: ${{secrets.TEAMS_APP_TENANT_ID}}
      M365_TITLE_ID: ${{secrets.M365_TITLE_ID}}
      M365_APP_ID: ${{secrets.M365_APP_ID}}
      TEAMS_APP_PUBLISHED_APP_ID: ${{secrets.TEAMS_APP_PUBLISHED_APP_ID}}
      
      AZURE_RESOURCE_GROUP_NAME: ${{secrets.AZURE_RESOURCE_GROUP_NAME}}
      RESOURCE_SUFFIX: ${{secrets.RESOURCE_SUFFIX}}

      TEAMSFX_ENV: dev
      APP_NAME_SUFFIX: dev

      TEAMSFX_ENV_NAME: 'dev'
      TEAMSFX_CLI_VERSION: 2.*
      CI_ENABLED: true
  
    steps:
      # Setup environment.
      - uses: actions/setup-node@v2
        with:
          node-version: '18'
          
      - name: Checkout the code
        uses: actions/checkout@v2
        
      # Build the project.
      # The way to build the current project depends on how you scaffold it.
      # Different folder structures require different commands set.
      # 'npm ci' is used here to install dependencies and it depends on package-lock.json.
      # If you prefer to use 'npm ci', please make sure to commit package-lock.json first, or just change it to 'npm install'.
      - name: Build the project
        run: npm ci && npm run build
     
     
      - name: Deploy to hosting environment
        uses: OfficeDev/teamsfx-cli-action@v1
        with:
          cli-version: ${{env.TEAMSFX_CLI_VERSION}}
          commands: deploy
          env: ${{env.TEAMSFX_ENV_NAME}}

我收到错误: (✖) 错误:由于操作失败,无法执行生命周期部署:azureAppService/zipDeploy。 GetPublishingCredentialsError:无法获取资源组“***”中应用程序“ME***”的发布凭据

该帐户对 Azure 中的订阅具有贡献者权限。

teams-toolkit
1个回答
0
投票

您能否尝试使用服务主体而不是 CICD 中更推荐的用户帐户来登录 Azure?

您可以在部署步骤之前显式添加一个登录步骤,如this

对于您的情况,以非交互模式登录Azure帐户进入teamsapp cli需要禁用MFA,我认为这可能是您失败的原因。

© www.soinside.com 2019 - 2024. All rights reserved.