2
你好社区#1,微软Azure部署JSON模板输出在PowerShell中
我与微软的Azure部署的问题,我试图访问SharedAccessPolicyKeys像物联网,集线器或事件集线器资源。
"outputs": {
"hubKeys": {
"value": "[listKeys(resourceId('Microsoft.Devices/IotHubs', parameters('hubName')), '2016-02-03')]",
"type": "object"
}
}
当我输出Windows PowerShell中返回的对象,但它看起来是这样的:我与listKeys功能和输出这些模板JSON文件中尝试这种
Type : Array
IsReadOnly : False
HasValues : True
First : {keyName, primaryKey, secondaryKey, rights}
Last : {keyName, primaryKey, secondaryKey, rights}
Count : 5
Parent : {{
"keyName": "iothubowner",
"primaryKey": "dZVFGkIysIgVRKjxlZsCWdk6KGa4rpBFlY6BOLmaiD8=",
"secondaryKey": "HtRYETAdgja/TBSS3sVTshKaGzZWMLbZC6GR60emSV4=",
"rights": "RegistryWrite, ServiceConnect, DeviceConnect"
} {
"keyName": "service",
"primaryKey": "DGOujP2tBTiTTdKxukTx7umeYFFlDEhoih7fb0tP3i8=",
"secondaryKey": "B+6j1nfEc59GAeJQNakNKolTBoR9kc5W+TUNzRXmDpc=",
"rights": "ServiceConnect"
} {
"keyName": "device",
"primaryKey": "qxmRJVH0yVhSkLEz8JaHhtDJaDofpw4SEKkZNlBwp7c=",
"secondaryKey": "RhUuME9EnnUsE2sixswaiTofKsVVfCQNIllwkHgY/8A=",
"rights": "DeviceConnect"
} {
"keyName": "registryRead",
"primaryKey": "pEpHrL4amd9+7pvl6uCiYHL3rZhxV76tZ1P9bERO6Xc=",
"secondaryKey": "6h4UBKd4WPkdpUfl0Hi3G5YKgB3LmtDMbgXDYx3eKrk=",
"rights": "RegistryRead"
} {
"keyName": "registryReadWrite",
"primaryKey": "HpCxKVa1686A8vOfNVBUzYSe2YJmKIwwAzxUh5DokuY=",
"secondaryKey": "PGeYYID9y6cClqGD1rl4koLNySc7kOGK6VuNlBiwqmo=",
"rights": "RegistryWrite"
}}
Root : {value}
Next :
Previous :
Path : value
LineNumber : 0
LinePosition : 0
AllowNew : True
AllowEdit : True
AllowRemove : True
SupportsChangeNotification : True
SupportsSearching : False
SupportsSorting : False
IsSorted : False
SortProperty :
SortDirection : Ascending
IsFixedSize : False
SyncRoot : System.Object
IsSynchronized : False
我问题:任何人都可以告诉我如何访问不同的“keyName”对象中的“primaryKey”?特别是我需要PrimaryKey作为“服务”。
我可以
$Key = New-AzureRmResourceGroupDeployment (deleted parameters for this post)
Write-Output $Key.Outputs.hubKeys
打印对象我已经尝试过的东西,比如$ Key.Outputs.hubKeys.value.Parents.values ....和无数的其他方式。有谁知道如何获得价值?
谢谢, 阿诺