You can enable guest attestation when you create a Trusted launch Azure Local VM via Azure CLI.
Create a Trusted launch VM
See Create Azure Local virtual machines enabled by Azure Arc for general instructions to create a Trusted launch Azure Local VM via Azure CLI.
Install the Azure Arc guest attestation extension
Construct the extension settings as follows:
- Attestation service endpoint
- Relying party service endpoint
- Cluster id
- Azure Active Directory (AAD) tenant id
Note
Extension settings are case-sensitive.
Here's an example:
# To connect to your Azure Local via Az CLI, see https://v4.hkg1.meaqua.org/en-us/azure/azure-local/azure-arc-vm-management-prerequisites.md?#azure-command-line-interface-cli-requirements.
# Login to Azure
[host1]: PS C:\Users\HCIDeploymentUser> az login --use-device-code
# Set your subscription
[host 1]: PS C:\Users\HCIDeploymentUser> az account set --subscription "<subscription>"
[host1]: PS C:\Users\HCIDeploymentUser> $cluster = (az stack-hci cluster show --subscription "<subscription>" --resource-group "<resource group>" --name "<Azure Local instance name>") | ConvertFrom-Json
[host1]: PS C:\Users\HCIDeploymentUser> $extensionSettings= '"{\"AttestationConfig\":{\"MaaSettings\":{\"maaEndpoint\": \"' + $cluster.isolatedVmAttestationConfiguration.attestationServiceEndpoint + '\",\"maaTenantName\": \"DUMMY_Tenant_NewConfig\"},\"AscSettings\":{\"ascReportingEndpoint\": \"' + $cluster.isolatedVmAttestationConfiguration.relyingPartyServiceEndpoint + '\",\"ascReportingFrequency\": \"4H\"},\"AzureStackSettings\":{\"clusterId\": \"'+$cluster.id+'\",\"clusterAadTenantId\": \"'+$cluster.aadTenantId+'\"},\"useCustomToken\": \"true\",\"disableAlerts\": \"false\",\"isAzureStack\": \"true\"}}"'
Deploy the Azure Arc guest attestation extension as shown in this example:
# Check if "connectedmachine" extension is already installed. If it is installed, it should be in the extensions list in the output of the command below.
[host1]: PS C:\Users\HCIDeploymentUser> az version
{
"azure-cli": "2.60.0",
"azure-cli-core": "2.60.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"aksarc": "1.2.20",
"arcappliance": "1.1.1",
"connectedk8s": "1.6.2",
"customlocation": "0.1.3",
"k8s-extension": "1.4.5",
"stack-hci-vm": "1.1.11"
}
}
# if "connectedmachine" extension is not already installed, add "connectedmachine" extension.
[host1]: PS C:\Users\HCIDeploymentUser> az extension add --name connectedmachine
az : WARNING: Default enabled including preview versions for extension installation now. Disabled in May 2024. Use '--allow-preview true'
to enable it specifically if needed. Use '--allow-preview false' to install stable version only.
+ CategoryInfo : NotSpecified: (WARNING: Defaul... version only. :String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
WARNING: The installed extension 'connectedmachine' is in preview.
# Run the command below to install the Azure Arc guest attestation extension.
[host1]: PS C:\Users\HCIDeploymentUser> az connectedmachine extension create --subscription "<subscription>" --resource-group "<resource group>" --machine-name "<name of VM>" --location "<Azure region of your Azure Local instance>" --publisher "Microsoft.Azure.Security.WindowsAttestation" --type "GuestAttestation" --name "GuestAttestation" --settings $extensionSettings --enable-automatic-upgrade
{
"id": "/subscriptions/<subscription id>/resourceGroups/<resource group name>/providers/Microsoft.HybridCompute/machines/myTVM/extensions/GuestAttestation",
"location": "eastus",
"name": "GuestAttestation",
"properties": {
"autoUpgradeMinorVersion": false,
"enableAutomaticUpgrade": true,
"instanceView": {
"name": "GuestAttestation",
"status": {
"code": "0",
"level": "Information",
"message": "Extension Message: Command: None, Status: has successfully completed. Details: [ Running Extension:GuestAttestation Operation:None ], Enable: Starting Enabling Step., Enable: Starting Client. Details: AszAttestationClient -a https://clustxxxxxxxxxx.eus2e.attest.azure.net -r https://dp.stackhci.azure.com/eastus/igvmAttestation/validxxxxx -l C:\\ProgramData\\GuestConfig\\extension_logs\\Microsoft.Azure.Security.WindowsAttestation.GuestAttestation -h C:\\Packages\\Plugins\\Microsoft.Azure.Security.WindowsAttestation.GuestAttestation\\1.0.1.30\\status\\HeartBeat.Json -s C:\\Packages\\Plugins\\Microsoft.Azure.Security.WindowsAttestation.GuestAttestation\\1.0.1.30\\status\\0.status -e events -v 1.0.1.30 -c /subscriptions/<subscription id>/resourceGroups/<resource group name>/providers/Microsoft.AzureStackHCI/clusters/<cluster name> -d xxxxxxxx--a9d3-41ba-88c3-796a643e3edd, Enable: Client : AszAttestationClient Started Successfully"
},
"type": "GuestAttestation",
"typeHandlerVersion": "1.0.1.30"
},
"provisioningState": "Succeeded",
"publisher": "Microsoft.Azure.Security.WindowsAttestation",
"settings": {
"AttestationConfig": {
"AscSettings": {
"ascReportingEndpoint": "https://dp.stackhci.azure.com/eastus/igvmAttestation/validxxxxx",
"ascReportingFrequency": "4H"
},
"AzureStackSettings": {
"clusterAadTenantId": "xxxxxxxx--a9d3-41ba-88c3-796a643e3edd",
"clusterId": "/subscriptions/<subscription id>/resourceGroups/<resource group name>/providers/Microsoft.AzureStackHCI/clusters/<cluster name>"
},
"MaaSettings": {
"maaEndpoint": "https://clustxxxxxxxxxxxxx.eus2e.attest.azure.net",
"maaTenantName": "My_Tenant_NewConfig"
},
"disableAlerts": "false",
"isAzureStack": "true",
"useCustomToken": "true"
}
},
"type": "GuestAttestation",
"typeHandlerVersion": "1.0.1.30"
},
"resourceGroup": "<resource group name>",
"type": "Microsoft.HybridCompute/machines/extensions"
}
View guest attestation status
You can view the guest attestation status using Azure CLI. The guest attestation status is listed by the following properties in the output:
"attestSecureBootEnabled": "Enabled",
"attestationCertValidated": "Valid",
"bootIntegrityValidated": "Valid",
"errorMessage": null,
"healthStatus": "Healthy",
"linuxKernelVersion": "0",
"provisioningState": "Succeeded",
Here’s the Az CLI command and sample output:
# To connect to your Azure Local via Az CLI, see https://v4.hkg1.meaqua.org/en-us/azure/azure-local/azure-arc-vm-management-prerequisites.md?#azure-command-line-interface-cli-requirements.
# Login to Azure
PS C:\WINDOWS\system32>az login --use-device-code
# Set your subscription
[host 1]: PS C:\Users\HCIDeploymentUser> az account set --subscription "<subscription>"
# Get list of installed extensions
PS C:\WINDOWS\system32>az version
{
"azure-cli": "2.61.0",
"azure-cli-core": "2.61.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"azure-iot": "0.11.0",
"stack-hci-vm": "1.1.11"
}
}
# If “stack-hci-vm” extension version isn't “1.1.12” or above, install the latest version of the extension.
PS C:\WINDOWS\system32>az extension remove --name stack-hci-vm
PS C:\WINDOWS\system32>az extension add --name stack-hci-vm
PS C:\WINDOWS\system32>az version
{
"azure-cli": "2.61.0",
"azure-cli-core": "2.61.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"azure-iot": "0.11.0",
"stack-hci-vm": "1.1.14"
}
}
# Check guest attestation status.
PS C:\WINDOWS\system32> az stack-hci-vm show --subscription "<subscription id>" --resource-group "<resource group name>" --name "<name of VM>"
Command group 'stack-hci-vm' is experimental and under development. Reference and support levels: https://aka.ms/CLI_refstatus
{
"attestationStatus": {
"id": "/subscriptions/<subscription id>/resourceGroups/<resource group name>/providers/Microsoft.HybridCompute/machines/<vm name>/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/AttestationStatus/default",
"name": "default",
"properties": {
"attestSecureBootEnabled": "Enabled",
"attestationCertValidated": "Valid",
"bootIntegrityValidated": "Valid",
"errorMessage": null,
"healthStatus": "Healthy",
"linuxKernelVersion": "0",
"provisioningState": "Succeeded",
"timestamp": "6/12/2024 8:49:33 PM"
},
"resourceGroup": "<resource group name>",
"systemData": {
"createdAt": "2024-06-12T20:49:33.545606+00:00",
"createdBy": "1412d89f-b8a8-4111-b4fd-e82905cbd85d",
"createdByType": "Application",
"lastModifiedAt": "2024-06-12T20:49:33.545606+00:00",
"lastModifiedBy": "1412d89f-b8a8-4111-b4fd-e82905cbd85d",
"lastModifiedByType": "Application"
},
"type": "microsoft.azurestackhci/virtualmachineinstances/attestationstatus"
},
"virtualmachineinstance": {
"extendedLocation": {
"name": "/subscriptions/<subscription id>/resourceGroups/<resource group name>/providers/Microsoft.ExtendedLocation/customLocations/cluster-customlocation",
"type": "CustomLocation"
},
"id": "/subscriptions/<subscription id>/resourceGroups/<resource group name>/providers/Microsoft.HybridCompute/machines/myTVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default",
"identity": null,
"name": "default",
"properties": {
"guestAgentInstallStatus": null,
"hardwareProfile": {
"dynamicMemoryConfig": {
"maximumMemoryMb": null,
"minimumMemoryMb": null,
"targetMemoryBuffer": null
},
"memoryMb": 2048,
"processors": 4,
"vmSize": "Custom"
},
"httpProxyConfig": null,
"instanceView": {
"vmAgent": {
"statuses": [
{
"code": "ProvisioningState/succeeded",
"displayStatus": "Connected",
"level": "Info",
"message": "Successfully established connection with mocguestagent",
"time": "2024-06-12T20:10:37+00:00"
},
{
"code": "ProvisioningState/succeeded",
"displayStatus": "Connected",
"level": "Info",
"message": "New mocguestagent version detected 'v0.14.0-2-g5c6a4b32'",
"time": "2024-06-12T20:10:36+00:00"
}
],
"vmConfigAgentVersion": "v0.14.0-2-g5c6a4b32"
}
},
"isHydration": null,
"networkProfile": {
"networkInterfaces": [
{
"id": "/subscriptions/<subscription id>/resourceGroups/<resource group name>/providers/Microsoft.AzureStackHCI/networkinterfaces/my-nic-static",
"resourceGroup": "<resource group name>"
}
]
},
"osProfile": {
"adminPassword": null,
"adminUsername": "<admin username>",
"computerName": "<computer name>",
"linuxConfiguration": {
"disablePasswordAuthentication": null,
"provisionVmAgent": true,
"provisionVmConfigAgent": true,
"ssh": {
"publicKeys": null
}
},
"windowsConfiguration": {
"enableAutomaticUpdates": null,
"provisionVmAgent": true,
"provisionVmConfigAgent": true,
"ssh": {
"publicKeys": null
},
"timeZone": null
}
},
"provisioningState": "Succeeded",
"resourceUid": null,
"securityProfile": {
"enableTpm": true,
"securityType": "TrustedLaunch",
"uefiSettings": {
"secureBootEnabled": true
}
},
"status": {
"errorCode": "",
"errorMessage": "",
"powerState": "Running",
"provisioningStatus": null
},
"storageProfile": {
"dataDisks": [],
"imageReference": {
"id": "/subscriptions/<subscription id>/resourceGroups/<resource group name>/providers/microsoft.azurestackhci/marketplacegalleryimages/Win11EntMulti23H2",
"resourceGroup": "<resource group name>"
},
"osDisk": {
"id": null,
"osType": "Windows"
},
"vmConfigStoragePathId": "/subscriptions/<subscription id>/resourceGroups/<resource group name>/providers/Microsoft.AzureStackHCI/storagecontainers/UserStorage2-7d0fdc06e3ef4c9d808ceb31379d0916" },
"vmId": "85b8849e-2965-4c82-b7fa-637796d22199"
},
"resourceGroup": "<resource group name>",
"systemData": {
"createdAt": "2024-06-12T20:03:18.171067+00:00",
"createdBy": "69be5a28-cb3c-4916-98c3-7e4ab37a83e0",
"createdByType": "Application",
"lastModifiedAt": "2024-06-12T20:11:55.649002+00:00",
"lastModifiedBy": "319f651f-7ddb-4fc6-9857-7aef9250bd05",
"lastModifiedByType": "Application"
},
"type": "microsoft.azurestackhci/virtualmachineinstances"
}
}