Azure / azure-cli

Azure Command-Line Interface
MIT License
3.96k stars 2.94k forks source link

[Feature Request]: Replace pull default SKR policy from github with MAA Service Discovery API and Policy template #28720

Closed praenubilus closed 4 months ago

praenubilus commented 5 months ago

Related command

az keyvault key create --default-cvm-policy

Is your feature request related to a problem? Please describe. Today default CVM SKR Policy is pull from a public Github repo
https://raw.githubusercontent.com/Azure/confidential-computing-cvm/main/cvm_deployment/key/skr-policy.json . This will hit performance issue with the expanding default policy file and also raising security concerns.

Describe the solution you'd like We have decided to replace the current implementation with MAA Service Discovery API to get regional default provider and fill it in the template as following:

{
    "anyOf": [
        {
            "allOf": [
                {
                    "claim": "x-ms-compliance-status",
                    "equals": "azure-compliant-cvm"
                }
            ],
            "authority": "{regional-maa-endpoint}"
        }
    ],
    "version": "1.0.0"
}

The service discovery API from MAA:

GET https://management.azure.com/subscriptions/{your_subscription}/providers/Microsoft.Attestation/Locations/{your_location}/defaultProvider?api-version=2020-10-01

Here is a reference application in Azure Powershell for default provider by location

This REST API is call to ARM, so all that's required is an Azure subscription and an identity (e.g., user, service principal, MSI identity, etc.) with RBAC permissions to access that subscription's resources.

For mooncake, Fairfax, USNAT and USSec the API part /subscriptions/{your_subscription}/providers/Microsoft.Attestation/Locations/{your_location}/defaultProvider?api-version=2020-10-01 remain the same. But the arm endpoint https://management.azure.com/ will be different (see below),

Describe alternatives you've considered NA

Additional context The current implementation in the repo: https://github.com/evelyn-ys/azure-cli/blob/f80e7d293c730547742871957e18eaac0f95cfb4/src/azure-cli/azure/cli/command_modules/keyvault/_validators.py#L29

yonzhan commented 5 months ago

Thank you for opening this issue, we will look into it.