引发类型为"Microsoft.Rest.Azure.CloudException"的异常 [英] Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown

查看:34
本文介绍了引发类型为"Microsoft.Rest.Azure.CloudException"的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用VSTS在Web应用程序上分配角色,但显示以下错误.

I am trying to assign role on web app using VSTS but below error displayed.

Powershell:

Powershell :

$webappname = "devt002"
$resourcegroup = "devt002RG"

#Get webapp object id
$webapp = Get-AzureRmWebApp -ResourceGroupName "$resourcegroup" -Name "$webappname"
$objectid = [System.Guid]::Parse($webapp.Identity.PrincipalId)
write-host "Object ID datatype :" $objectid.GetType().FullName
write-host "Object ID :" $objectid


#Get Assign role if already exist
$roles = Get-AzureRmRoleAssignment -ObjectId $objectid
write-host "Already Assigned Roles :" $roles.RoleDefinitionName

错误:

2019-04-05T11:20:23.7408185Z ##[debug]Caught exception from task script.
2019-04-05T11:20:23.7408790Z ##[debug]Error record:
2019-04-05T11:20:23.7408993Z ##[debug]Get-AzureRmRoleAssignment : Exception of type 'Microsoft.Rest.Azure.CloudException' was thrown.

注意:它在本地Powershell客户端中运行良好.仅与VSTS有关.

Note : It is working fine in local powershell client. Issue only with VSTS.

推荐答案

检查是否提供了正确的对象ID.如果要通过变量提供对象ID,则需要更改值.

Check have you provided correct Object ID. If you are providing Object ID via Variables, Value needs to be changed.

这篇关于引发类型为"Microsoft.Rest.Azure.CloudException"的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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