【问题标题】:Azure app deployment error: Resource doesn't existAzure 应用部署错误:资源不存在
【发布时间】:2021-06-16 06:12:53
【问题描述】:

我是 Azure 的新手,我遇到了一个又一个的问题,但我仍然认为我已经走了很远。我使用此命令创建了凭据:

 az ad sp create-for-rbac --name "myApp" --role contributor --scopes /subscriptions/{sub-id}/resourceGroups/{SomeRes} --sdk-auth

复制粘贴在github上的秘密处。 然后前面的任务运行良好,但是在这个任务上失败了:Run Azure webapp deploy action using azure credentials

      # Run dotnet build and publish 
      - name: dotnet build and publish 
        working-directory: ./myDemoApp
        run: | 
          dotnet restore 
          dotnet build --configuration Release 
          dotnet publish -c Release -o '/someDemoApp'  
           
      # Deploy to Azure Web apps 
      - name: 'Run Azure webapp deploy action using azure credentials' 
        uses: azure/webapps-deploy@v2 
        with:  
          app-name: SomeDemoApp
          package: './myDemoApp/someDemoApp' 
       
      - name: logout 
        run: | 
          az logout

它返回这个错误:

Error: Deployment Failed with Error: Error: Resource SomeDemoApp doesn't exist.

如何配置它以便我可以部署它?

更新:

通过创建应用修复了第一个错误,但现在找不到包并返回此错误:

Error: Deployment Failed with Error: Error: No package found with specified pattern: ./myDemoApp/someDemoApp

我在哪里可以找到这个包的位置,或者与我的哪个配置相关?

【问题讨论】:

    标签: azure azure-web-app-service github-actions


    【解决方案1】:

    此错误仅表示您正在尝试将代码部署到 Web 应用程序,但尚未在 Azure 中创建 Web 应用程序(为什么它不存在)。

    您可以按照 Microsoft 的本教程手动部署您的 Web 应用程序。 (确保网络应用名称与您在 yaml 中的名称完全相同):https://docs.microsoft.com/en-us/azure/app-service/quickstart-dotnetcore?tabs=netcore31&pivots=platform-linux

    在部署 Web 应用程序后运行您的管道应该可以工作。

    一旦您对这种方法更加熟悉,您就可以将基础架构作为代码添加到您的 yaml 管道中,以使用 ARM 模板和管道中的 AzureResourceManagerTemplateDeployment@3 任务自动启动您的网络。

    【讨论】:

    • 这也可能意味着用于部署的帐户没有足够的资源组/资源访问权限。
    • 那个链接确实有帮助,但现在我得到这个错误:Error: Deployment Failed with Error: Error: No package found with specified pattern: ./myDemoApp/someDemoApp,这怎么解释?
    • 我也有同样的信息。资源不存在。资源在部署之前应该存在。对我有用的是将具有角色贡献者的服务主体添加到资源组。
    猜你喜欢
    • 2011-04-11
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 2018-08-30
    • 1970-01-01
    • 1970-01-01
    • 2019-06-26
    • 1970-01-01
    相关资源
    最近更新 更多