deislabs/cnab-azure-driver

Invalid parsing of MSI scope

Closed this issue · 1 comments

When supplying a CNAB_AZURE_SYSTEM_MSI_SCOPE it is parsed against the Azure resource id regex which errors on valid scopes. The autorest parser expects a fully formed resource id ((?i)subscriptions/(.+)/resourceGroups/(.+)/providers/(.+?)/(.+?)/(.+)). However, MSI scopes can be defined by prefixes such as /subscriptions/(.+) or /subscriptions/(.+)/resourceGroups/(.+) which fail this regex match.
In fact, if you leave CNAB_AZURE_SYSTEM_MSI_SCOPE empty the scope is set by the driver to fmt.Sprintf("/subscriptions/%s/resourcegroups/%s", d.subscriptionID, d.aciRG) - but you can't actually supply this value as the scope via the command line as it will fail parsing.
bug

If we agree this is a bug, I'll look to fix it when I find time.

Offending line:

_, err := azure.ParseResourceID(d.systemMSIScope)

@jjcollinge yes please fix if you have time