【问题标题】:Azure automation with cosmosDB使用 cosmosDB 实现 Azure 自动化
【发布时间】:2018-11-27 17:40:14
【问题描述】:

尝试使用 Azure 自动化运行手册对 CosmosDB 执行一些更新。我已经创建了一个 RunAs 服务主体帐户来向 Azure 进行身份验证

更新用于 Get-AzureRmResource 的模块似乎会导致一些问题,我无法再检索 CosmosDB 对象。

$Conn = Get-AutomationConnection -Name "AzureRunAsConnection"
Add-AzureRmAccount -ServicePrincipal -Tenant $Conn.TenantID `
-ApplicationID $Conn.ApplicationID -CertificateThumbprint 
$Conn.CertificateThumbprint

Select-AzureRmSubscription -SubscriptionName "Visual Studio Enterprise" -ErrorAction SilentlyContinue

   #resource and app variables declared here.

$cosmosDbResource = (Get-AzureRmResource -ResourceType 
"Microsoft.DocumentDb/DatabaseAccounts" -ResourceGroup $applicationGroup - 
ApiVersion "2015-04-08" -Name $cosmosDBName)

"Before CosmosDB Resource"
$cosmosDbResource | FT
"Cosmos DB Properties"
$cosmosDbResource.Properties

此代码在使用模块的自动化帐户的简单部署中运行良好。 AzureRM.Resources 在 1.0.3。

如果我尝试将 AzureRM.Resource 及其依赖项更新到 6.1.0,我将无法再检索我的 CosmosDB 实例。

我认为更新后的powershell模块可能有冲突

【问题讨论】:

    标签: azure azure-cosmosdb azure-automation


    【解决方案1】:

    取决于您希望在 cosmosdb 中更新的内容.....

    官方的 cosmosdb powershell 模块目前还不够完善,请查看社区 cosmosdb powershell 模块,它功能更丰富且更易于使用:

    https://github.com/PlagueHO/CosmosDB

    【讨论】:

    • 很高兴了解与 cosmosDB 一起使用的其他 powershell 模块,但我已经使用其他 api 直接影响我的 cosmos 实例,所以我没有测试这是否解决了我的问题操作手册。
    猜你喜欢
    • 2018-06-14
    • 2016-10-10
    • 2021-09-28
    • 2016-11-27
    • 2017-11-13
    • 2020-01-09
    • 2014-09-03
    • 2017-11-29
    • 1970-01-01
    相关资源
    最近更新 更多