首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >部署到无服务器Azure函数失败

部署到无服务器Azure函数失败
EN

Stack Overflow用户
提问于 2020-05-22 15:03:17
回答 1查看 777关注 0票数 0

我正在尝试在Azure门户中已经创建的App中部署Azure函数。

使用sls deploy CLI部署我的Azure函数,但是在部署这些函数时,sls正在尝试创建我无法访问的新资源组。

以下是sls deploy命令的输出:

代码语言:javascript
复制
$ sls deploy
Serverless: Removing .serverless directory
Serverless: Parsing Azure Functions Bindings.json...
Serverless: Building binding for function: admin event: httpTrigger
Serverless: Parsing Azure Functions Bindings.json...
Serverless: Building binding for function: image event: httpTrigger
Serverless: Parsing Azure Functions Bindings.json...
Serverless: Building binding for function: report event: httpTrigger
Serverless: Parsing Azure Functions Bindings.json...
Serverless: Building binding for function: gaims event: httpTrigger
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Logging into Azure
Serverless: Using subscription ID: <SUBSCRIPTION_ID>
Serverless: Creating resource group: <ALREADY_CREATED_RESOURCE_GROUP_NAME>

  Error --------------------------------------------------

  Error: The client '<USER_NAME>' with object id '<OBJECT_ID>' does not have authorization to perform action 
     'Microsoft.Resources/subscriptions/resourcegroups/write' over scope 
    '/subscriptions/SUBSCRIPTION_ID/resourcegroups/ALREADY_CREATED_RESOURCE_GROUP_NAME' or the scope is invalid. 
    If access was recently granted, please refresh your credentials.
      at new RestError (C:\Users\analysis-node\node_modules\@azure\ms-rest-js\lib\restError.ts:18:5)
      at C:\Users\analysis-node\node_modules\@azure\ms-rest-js\lib\policies\deserializationPolicy.ts:117:27
      at process._tickCallback (internal/process/next_tick.js:68:7)

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              10.20.1
     Framework Version:         1.71.1
     Plugin Version:            3.6.12
     SDK Version:               2.3.0
     Components Version:        2.30.11

serverless.yml中,我还指定了resourceGroup参数。以下是serverless.yml的要点

代码语言:javascript
复制
provider:
  stage: dev
  name: azure
  region: East US 2
  runtime: nodejs10.x
  resourceGroup: <ALREADY_CREATED_RESOURCE_GROUP_NAME>
  subscriptionId: <SUBSCRIPTION_ID>

在部署函数时可以使用的serverless cli中是否有设置资源组的方法?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-24 09:50:14

我能够通过将部署分解为两部分来部署Azure函数

  1. 使用无服务器打包项目。 sls封装
  2. 使用Azure CLI部署打包的zip文件。 -g {RESOURCE_GROUP} -n {APP_SERVICE_NAME} -src. .serverless/project-zip.zip

希望这对面临同样问题的人有所帮助。

编辑:

看起来这个问题可能会在即将发布的版本中得到解决。

链接:https://github.com/serverless/serverless-azure-functions/issues/469

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61957969

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档