小编Ryv*_*vik的帖子

通过“@”提供输入文件会出现错误:无法使用展开运算符“@”来引用表达式中的变量

按照此处的示例https://learn.microsoft.com/en-us/cli/azure/vm/run-command?view=azure-cli-latest

我在运行命令时遇到错误

az vm run-command invoke  --command-id RunPowerShellScript --name win-vm -g my-resource-group --scripts @script.ps1
Run Code Online (Sandbox Code Playgroud)

错误:

展开运算符“@”不能用于引用表达式中的变量。“@script”只能用作命令的参数。要引用表达式中的变量,请使用“$script”。

将其放在引号中只会传入引号中的内容,而不是脚本的内容。

powershell escaping az

12
推荐指数
2
解决办法
2万
查看次数

从Graph API获取指定用户

如何通过Graph API返回单个指定用户?

我能够返回所有用户,但需要通过 CLI 参数获取单个用户。

c# azure-ad-graph-api

3
推荐指数
1
解决办法
8320
查看次数

如何从 Azure PowerShell 为用户请求 Azure Graph API 访问令牌?

我熟悉在 Az CLI 中请求令牌——az account get-access-token --resource-type ms-graph | ConvertFrom-Json但我需要从 Azure PowerShell 获取令牌。我知道您可以通过以下方式请求 REST API 令牌

$currentAzureContext = Get-AzContext
$profileClient = New-Object Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient([Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile);
$UserToken = $profileClient.AcquireAccessToken($currentAzureContext.Subscription.TenantId).AccessToken;
Run Code Online (Sandbox Code Playgroud)

但同样,我需要一个 Graph 访问令牌。有没有办法做到这一点?

powershell azure

1
推荐指数
1
解决办法
532
查看次数

标签 统计

powershell ×2

az ×1

azure ×1

azure-ad-graph-api ×1

c# ×1

escaping ×1