我正在研究一个Azure Powershell脚本,该脚本将比较两个Azure KeyVault的秘密和访问策略。
为了比较Azure KeyVault的秘密,我使用了以下命令
Get-AzureKeyVaultSecret
效果很好,
但是对于访问策略来说,似乎没有像Get-AzKeyVaultAccessPolicy
这样的命令。
那么,有什么方法可以使用Azure PowerShell从KeyVault检索访问策略吗?
答案 0 :(得分:1)
如果您正在使用AZ cli获取访问策略,则可以使用以下命令获取访问策略:
az keyvault show --name
[--resource-group]
[--subscription]
如果使用的是Azure RM模块,则只需调用以下命令:
Get-AzureRMKeyVault -VaultName 'myvault'
Vault Name : myvault
Resource Group Name : myrg
Location : westus
Resource ID : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/myrg/providers
/Microsoft.KeyVault/vaults/myvault
Vault URI : https://myvault.vault.azure.net/
Tenant ID : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
SKU : Standard
Enabled For Deployment? : True
Enabled For Template Deployment? : True
Enabled For Disk Encryption? : False
Soft Delete Enabled? : True
Access Policies :
Tenant ID : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
Object ID : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
Application ID :
Display Name : User Name (username@microsoft.com)
Permissions to Keys : get, create, delete, list, update,
import, backup, restore, recover
Permissions to Secrets : get, list, set, delete, backup,
restore, recover
Permissions to Certificates : get, delete, list, create, import,
update, deleteissuers, getissuers, listissuers, managecontacts, manageissuers,
setissuers, recover
Permissions to (Key Vault Managed) Storage : delete, deletesas, get, getsas, list,
listsas, regeneratekey, set, setsas, update
Tags :
希望有帮助。
答案 1 :(得分:0)
这是Azure Powershell的解决方案:
<StackLayout
HorizontalOptions="FillAndExpand"
Padding="5"
VerticalOptions="CenterAndExpand">
<Label
Text="Email"
TextColor="Black"
FontSize="Medium"/>
<Frame
CornerRadius="15"
Padding="2,-3,-3,-3"
HasShadow="false"
BorderColor="#c0eefb"
OutlineColor="#c0eefb">
<local:ImageEntry
Image="ic_email_entry_image_xx"
x:Name="username_entry"
Text="charlesgeorge.admin"
FontSize="Medium"
HorizontalOptions="FillAndExpand"
Keyboard="Email"/>
</Frame>
<Label
Text="Password"
Margin="0,5,0,0"
TextColor="Black"
FontSize="Medium"/>
<Frame
CornerRadius="15"
Padding="2,-3,-3,-3"
HasShadow="false"
BorderColor="#c0eefb"
OutlineColor="#c0eefb">
<local:ImageEntry
Image="ic_password_entry_image_xx"
x:Name="password_entry"
FontSize="Medium"
Text="admingeorge1@"
HorizontalOptions="FillAndExpand"
IsPassword="True"/>
</Frame>
<Button
Text="SIGN IN"
Margin="0,15,0,15"
HeightRequest="40"
WidthRequest="180"
FontSize="Large"
TextColor="White"
HorizontalOptions="CenterAndExpand"
BackgroundColor="#26B5D6"
Clicked="SignInButtonCliked"
BorderRadius="20"/>
</Button>
</StackLayout>
注意:如果您想获取Azure CLI或Azure RM的解决方案,请考虑查看下面的Mohit's答案。