标签: azure-cloud-shell

云“AzureCloud”中不存在 xxx' 的订阅

我试图按照如何描述使用Azure的云壳Terraform安装和配置,以提供虚拟机和其他基础设施到Azure的例子在这里

以下命令提供了订阅 ID 和租户 ID:

az account show --query "{subscriptionId:id, tenantId:tenantId}"
Run Code Online (Sandbox Code Playgroud)

但是,该命令提供了以下错误:

云“AzureCloud”中不存在“”的订阅。

azure azure-cloud-shell

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

使用 curl 拒绝 Azure Kudu 访问

按照 Azure Kudu 网页的建议,尝试从 curl 访问 Azure App 日志流。我在 Windows 10 命令提示符下。这是我正在尝试的示例命令行:

curl -u myUserName https://myApp.scm.azurewebsites.net/api/logstream
Enter host password for user 'myUserName':<password typed here>
Run Code Online (Sandbox Code Playgroud)
  • myApp: 是我的 Azure 应用服务的名称。

  • myUserName

    • 我尝试使用从 Web 部署配置文件中获取的凭据,这是 Visual Studio 发布配置文件使用的凭据。也就是说,当用户看起来像$myApp并且密码是一些 60 字符长的字符串时。
    • 我还尝试从 Azure 门户 > MyApp > 部署凭据创建用户级部署凭据,它要求提供部署/FTP 用户名和密码

在这两种情况下,curl 都会显示网页标题401的内容- 未经授权:由于凭据无效,访问被拒绝。. 我还尝试将用户名用双引号括起来,并用反斜杠 (\) 转义美元符号 ($)。没运气。

我一定是在做一些非常愚蠢的事情。我已经阅读了几个文档和帖子,比如官方 Kudu 文档msdn在 SO 上,我想我正在按照说明进行操作。其他来源:再次 MSDN旧的 seirer 帖子

编辑

经过建议,我尝试使用用户级部署凭据和 …

azure kudu azure-cli azure-cloud-shell

9
推荐指数
2
解决办法
6359
查看次数

Set-AzContext 在 Azure Cloud Shell 中有效,但在 Azure PowerShell 中无效

当我执行以下命令时

Clear-AzureProfile
Connect-AzAccount -TenantID xxxxxxxxxxxxxxxxxxx
Set-AzContext -SubscriptionId xxxxxxxxxxxxxxxxxxx
Run Code Online (Sandbox Code Playgroud)

Azure PowerShell我得到这个错误。

Set-AzContext : Please provide a valid tenant or a valid subscription.
At line:6 char:1
+ Set-AzContext -SubscriptionId xxxxxxxxxxxxxxxxxxx
Run Code Online (Sandbox Code Playgroud)

如果我在Azure Cloud Shell其中运行相同的命令,它会起作用

Name        Account         SubscriptionName    Environment    TenantId         
xxxx        xxxxxxx         xxxx                 xxxx             xxxx
Run Code Online (Sandbox Code Playgroud)

我从免费试用切换到即用即付订阅,并在这两种环境中使用凭据进行即用即付,但它不起作用。谁能帮忙

powershell azure azure-powershell azure-cloud-shell

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

Add-AzTableRow 命令在 Azure Cloud Shell 中不可用

我正在尝试使用 Azure Cloud Shell 在我的表存储中插入新行,但我面临以下异常。所以让我知道我们需要用来插入的任何其他命令。

块引用

 Add-AzTableRow: The term 'Add-AzTableRow' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Run Code Online (Sandbox Code Playgroud)

块引用

下面是命令:

$partitionKey1 = "partition1"
$partitionKey2 = "partition2"


Add-AzTableRow `
    -table $cloudTable `
    -partitionKey $partitionKey1 `
    -rowKey ("CA") -property @{"username"="Chris";"userid"=1}
Run Code Online (Sandbox Code Playgroud)

azure-storage azure-table-storage azure-cloud-shell

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

如何修复 Azure Cloud Shell 错误“MissingSubscriptionRegistration - 订阅未注册为使用命名空间“Microsoft.Storage””

我刚刚尝试使用在 Build 2017 上宣布的新奇 Azure Cloud Shell,但收到以下错误(作为 json 消息):

  {
    "error": {
        "code": "MissingSubscriptionRegistration",
        "message": "The subscription is not registered to use namespace 'Microsoft.Storage'"
    }
  }
Run Code Online (Sandbox Code Playgroud)

我用谷歌搜索了这个并找到了答案,建议我需要注册一个资源提供者:

Register-AzureRmResourceProvider -ProviderNamespace Microsoft.Storage
Run Code Online (Sandbox Code Playgroud)

或者

azure provider register Microsoft.Storage
Run Code Online (Sandbox Code Playgroud)

...但我懒得设置到 Azure 的命令行会话。

如何使用 Azure 门户执行此操作?

azure azure-cloud-shell

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

Azure Cloud Shell 文件共享包含 5GB IMG 文件

我在 Azure 门户中创建了一个 PowerShell 云外壳,配置为使用现有的通用 v2 存储帐户。创建了一个新的文件共享并为其命名。当我查看文件共享时,我可以看到一个文件夹“.cloudconsole”,其中一个文件位于“acc_[name].img”中。文件大小为 5GB。

题:

  1. 这个“.img”文件是做什么用的?
  2. 将此文件保存在存储帐户中是否会产生相关费用?

azure azure-cloud-shell

5
推荐指数
2
解决办法
3437
查看次数

有没有办法从Azure Cloud Shell下载文件?

我正在尝试获取Azure Kubernetes群集的凭据。运行脚本以获取Azure云外壳上的详细信息,并获得一个.config文件。我想知道是否可以通过Azure Cloud Shell会话下载文件吗?

azure azure-storage-files azure-cloud-shell

5
推荐指数
2
解决办法
1569
查看次数

Azure Cloud Shell运行ps1脚本时遇到问题

在我们的Azure Cloud Shell,Powershell模式中,我们无法运行ps1文件.虽然我们在MS Doc中做同样的事情.任何建议,我做错了什么.

    PS Azure:\> dir


    Directory: Azure:/Shared PAAS – Test/StorageAccounts/tstoweuyptobi/Files/azureshellfiles/goal0402preprod/powershell


Mode Name
---- ----
.    Build_goal.ps1
.    Test goal_Files.ps1
.    test.ps1


Azure:/Shared PAAS – Test/StorageAccounts/tstoweuyptobi/Files/azureshellfiles/goal0402preprod/powershell
PS Azure:\> ./test.ps1
./test.ps1 : The term './test.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ ./test.ps1
+ ~~~~~~~~~~
+ CategoryInfo …
Run Code Online (Sandbox Code Playgroud)

azure-cloud-shell

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

Azure WebApp容器重启问题

我已经创建了一个运行grafana docker映像的网络应用,如下所示

az group create --name grp-test-container-1 
                --location "West Europe"
az appservice plan create --name asp-test-container-1 
                          --resource-group grp-test-container-1 
                          --sku B1 
                          --is-linux
az webapp create --resource-group grp-test-container-1 
                 --plan asp-test-container-1 
                 --name app-test-container-1 
                 --deployment-container-image-name grafana/grafana:latest
Run Code Online (Sandbox Code Playgroud)

然后我更新了appsettings以便将env变量传递给docker run命令

az webapp config appsettings set --name app-test-container-1 
                                 --settings GF_INSTALL_PLUGINS='grafana-azure-monitor-datasource' 
                                 --resource-group grp-test-container-1
Run Code Online (Sandbox Code Playgroud)

然后,我需要重新启动容器,以便在docker run命令中获取添加的env变量。

我试图重新启动Web应用程序,停止/启动它,更改docker映像名称并保存在Container Settings下。

在此处输入图片说明

有什么建议么?

解决方案/错误

正如Charles Xu在回答中所说,要重新加载容器,您需要更改docker映像并保存,以使Web应用程序再次获取该映像并应用添加的env变量。

就我而言,我做了更改,然后查看了日志输出,但是日志从未更新过。我等待了5-10分钟,但仍然没有添加日志。

但是,当我访问该站点并浏览到由env变量安装的扩展程序时,我可以确定一切都已通过。

因此,总结一下:容器设置中的日志是不可信的,进行更改时,这些更改可能不会显示在日志中。

azure docker azure-cloud-shell

5
推荐指数
2
解决办法
614
查看次数

Azure 云外壳中缺少新的 AzureADPolicy

Azure 云外壳中缺少新的 AzureADPolicy

New-AzureADPolicy : The term 'New-AzureADPolicy' is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Run Code Online (Sandbox Code Playgroud)

另外如果尝试安装 AzureADPreview

Install-Module -Name AzureADPreview
Run Code Online (Sandbox Code Playgroud)

结果是:

PackageManagement\Install-Package : Unable to load shared library 'api-ms-win-core-sysinfo-l1-1-0.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libapi-ms-win-core-sysinfo-l1-1-0.dll: cannot open shared …
Run Code Online (Sandbox Code Playgroud)

azure azure-powershell azure-active-directory azure-cloud-shell

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