Web Job的自动化Power Shell部署菜单 [英] Automated Power Shell Deploymenr of Web Job

查看:101
本文介绍了Web Job的自动化Power Shell部署菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

供应商正在尝试使用下面的Power Shell自动执行Web Job的部署,该错误具有以下错误.

A vendor is trying to automate the deployment of a Web Job using the below Power Shell which has the following errors.

电源外壳示例来自https://docs.microsoft.com/zh-cn/azure/app-service/app-service-deploy-zip

The power shell example is from https://docs.microsoft.com/en-us/azure/app-service/app-service-deploy-zip

任何人都可以帮助解决该问题吗?

Can anyone help resolve the issue?

running it now
Invoke-RestMethod :
401 - Unauthorized: Access is denied due to invalid credentials.
Server Error

  401 - Unauthorized: Access is denied due to invalid credentials.
  You do not have permission to view this directory or page using the credentials that you supplied.

At line:8 char:1
+ Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}"  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand 
#PowerShell
$username = "<USERNAME>"
$password = "<PASSWORD>"
$filePath = "C:\temp\deploy.zip"
$apiUrl = "https://<URL>/api/continuous/APP"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password)))
$userAgent = "powershell/1.0"
Invoke-RestMethod -Uri $apiUrl -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -UserAgent $userAgent -Method POST -InFile $filePath -ContentType "multipart/form-data" 
 


推荐答案

如错误描述中所述,您需要确保用户具有足够的权限来访问Web作业

As mentioned in the error description, you need to make sure the user have the enough permission to access the Web Jobs

检查用户是否具有 至少对Azure应用服务具有贡献者权限

Check whether the user as having contributor permission atleast for the Azure App Service


这篇关于Web Job的自动化Power Shell部署菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆