-
Notifications
You must be signed in to change notification settings - Fork 153
Builds failing when MSI to authenticate with Azure Storage #31
Comments
Hi, there is an incompatibility using the AIB Service Principal (SPN), in combination with a user identity, which you may use to authenticate with Azure Storage. However, we have made a simpler option available now, where you can grant the user identity rights to the resource group where you want to read or write images too. I have updated the example here, so you can see how to assign a user identity permissions. We will be releasing more information on this very soon, again, apologies for the inconvenience here. |
Is this new way compatible with the 'File' customizer, allowing a file to be downloaded from an Azure Storage Account with access under the context of a User Assigned Identity? |
@danielsollondon : I'm still not able to make this work. Azure doesn't have the role "Azure Image Builder Service Image Creation Role" that was mentioned in the doc Also, I removed AIB role and added user identity as contributor at Resource Group. Now the 1st step of template building itself is failing after 4 mins with the default failure message shown below..I am using east us2 region for my build. { |
Ignore my above message.. I figured out the failure reason. Template fails if we enable firewall setting on storage account. Even if we enable "Allow trusted Microsoft services to access this storage account" still it fails. So for testing, i had to temporary disable firewall rules on storage and it worked for 2019 windows datacenter using file customizer. FYI.. |
@sajithvasu - thank you for letting me know, I am about to do a docs refresh soon, so I will incorporate this, I will leave the issue open until then. |
Ciao, I confirm that I too have incurred in the same issue with firewall settings on the storage account. I had restricted the Storage Account using Service Endpoint, and enabling the VNET that Image Builder would use to build the VM. |
I am also encountering an error when creating my template. In the template, I am accessing Azure Storage using a managed identity passed to Image Builder. I am quite sure that the error is related to Azure Storage access, as when I remove the steps that are accessing scripts in my Storage account, I am able to create the template without error. Also, when I go to inspect the failure in the activity log, I can see that the provisioning error code is In my case, the managed identity being passed to Image Builder has been assigned the |
@christopherbantle you need to assign explicitly at least the Storage Blob Data Reader to have permissions to access the blobs, this is standard requisite for accessing blob storage, is not related to Azure Image Builder. You can test by yourself from the azure portal if you click "Switch to Azure AD permissions" in the explorer container window. Instead the topic regarding firewall rules remain pending. |
Daniel, I am able to download any script directly with the file customizer or the powershell script uri using the User Assigned Identity which has been granted the Storage Blob Data Reader role on the resource group with the image assets storage account (contains blobs with zip files). However, when I run a master customization script that tries to download additional zip files and other sources to the image, it does not work. This script works great when I append a SAS Token to the uri for each blob but not without. I don't know if the issue is with the script running elevated and therefore possibly not with the User Assigned Identity. |
Hi Shawn - please can you raise a case for this: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/image-builder-troubleshoot#getting-support |
@microsoft -- any progress here? Not only do some corporate policies require using Private Link, Microsoft's own documentation calls this out as a best security practice. Are there any plans to update the Image Builder to allow customers to follow best practices for securing the Storage Account used for artifacts accessed by Image Builder file customizer? |
@danielsollondon is the service still under development? I saw that the corresponding repository has not been updated in a while. I build a solution for my customers based on the AIB some time ago and wanted to upgrade it to private networking since Deployment Scripts now support Private Networking too - and essentially aspire to have everything as private as possible. Yet the described network limitation seem to prevent me from doing so (Scenario: AIB in existing subnet with Storage Endpoint to Storage Account with Active Firewall that clearlists the subnet. Data Blob Reader Permissions set up. Yet I always get an unauthorized issue so I can only assume the ServiceEndpoint is not enough for the AIB) |
If you are using managed identity to access azure storage (similar to this Quickstart) we have an issue with the service that is causing builds to fail, this is agnostic of source OS.
I will test, and update the docs, please give me 24hrs.
Apologies for the inconvenience here.
Thanks,
The text was updated successfully, but these errors were encountered: