-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Compute] Add Managed Identity Support in Azure Disk Encryption for VMSS #30657
Changes from 5 commits
ef9c6c3
7d705d4
0aa9c5d
169d10c
24bd401
6b9a604
70b106c
54e871b
aaaf57e
b62a1cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3171,7 +3171,7 @@ def create_vmss(cmd, vmss_name, resource_group_name, image=None, | |||||||||
public_ip_address_type=None, storage_profile=None, | ||||||||||
single_placement_group=None, custom_data=None, secrets=None, platform_fault_domain_count=None, | ||||||||||
plan_name=None, plan_product=None, plan_publisher=None, plan_promotion_code=None, license_type=None, | ||||||||||
assign_identity=None, identity_scope=None, identity_role=None, | ||||||||||
assign_identity=None, identity_scope=None, identity_role=None, encryption_identity=None, | ||||||||||
identity_role_id=None, zones=None, priority=None, eviction_policy=None, | ||||||||||
application_security_groups=None, ultra_ssd_enabled=None, | ||||||||||
ephemeral_os_disk=None, ephemeral_os_disk_placement=None, | ||||||||||
|
@@ -3532,6 +3532,35 @@ def _get_public_ip_address_allocation(value, sku): | |||||||||
role_assignment_guid = str(_gen_guid()) | ||||||||||
master_template.add_resource(build_msi_role_assignment(vmss_name, vmss_id, identity_role_id, | ||||||||||
role_assignment_guid, identity_scope, False)) | ||||||||||
if encryption_identity: | ||||||||||
if not cmd.supported_api_version(min_api='2023-09-01', resource_type=ResourceType.MGMT_COMPUTE): | ||||||||||
raise CLIError("Usage error: Encryption Identity required API version 2023-09-01 or higher." | ||||||||||
"You can set the cloud's profile to use the required API Version with:" | ||||||||||
"az cloud set --profile latest --name <cloud name>") | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please set the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed Suggestion |
||||||||||
|
||||||||||
if 'identity' in vmss_resource and 'userAssignedIdentities' in vmss_resource['identity'] \ | ||||||||||
and encryption_identity.lower() in \ | ||||||||||
(k.lower() for k in vmss_resource['identity']['userAssignedIdentities'].keys()): | ||||||||||
|
||||||||||
if 'virtualMachineProfile' not in vmss_resource['properties']: | ||||||||||
vmss_resource['properties']['virtualMachineProfile'] = {} | ||||||||||
if 'securityProfile' not in vmss_resource['properties']['virtualMachineProfile']: | ||||||||||
vmss_resource['properties']['virtualMachineProfile']['securityProfile'] = {} | ||||||||||
if 'encryptionIdentity' not in vmss_resource['properties']['virtualMachineProfile']['securityProfile']: | ||||||||||
vmss_resource['properties']['virtualMachineProfile']['securityProfile']['encryptionIdentity'] = {} | ||||||||||
|
||||||||||
vmss_securityProfile_EncryptionIdentity \ | ||||||||||
= vmss_resource['properties']['virtualMachineProfile']['securityProfile']['encryptionIdentity'] | ||||||||||
|
||||||||||
if 'userAssignedIdentityResourceId' not in vmss_securityProfile_EncryptionIdentity or \ | ||||||||||
vmss_securityProfile_EncryptionIdentity['userAssignedIdentityResourceId'] \ | ||||||||||
!= encryption_identity: | ||||||||||
vmss_securityProfile_EncryptionIdentity['userAssignedIdentityResourceId'] = encryption_identity | ||||||||||
vmss_resource['properties']['virtualMachineProfile']['securityProfile']['encryptionIdentity'] \ | ||||||||||
= vmss_securityProfile_EncryptionIdentity | ||||||||||
else: | ||||||||||
raise CLIError("Encryption Identity should be an ARM Resource ID of one of the " | ||||||||||
"user assigned identities associated to the resource") | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use the specific error type
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During VMSS creation if there is any exception, it will throw cliError exception by default, that's why used that cliError exception here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, we usually recommend using more specific error type if they can be clearly classified, as this will help us in future Telemetry data analysis There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed Suggestion |
||||||||||
else: | ||||||||||
raise CLIError('usage error: --orchestration-mode (Uniform | Flexible)') | ||||||||||
|
||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask what is the difference between the
--assign-identity
and--encryption-identity
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--assign-identity params is used to assign system or user assigned identities associated with the Virtual Machine Scale set. There can be multiple user assigned identities associated with the virtual machine scale set.
--encryption-identity params is used to set which Identity used by ADE to get access token for keyvault operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks~