-
Notifications
You must be signed in to change notification settings - Fork 0
Description
π Copied from microsoft/fabric-cli#77 for AI triage testing.
Expected triage outcome: Potential Bug
Bug Description
When a user is not authorized to read the Azure resource for which the Private Endpoint is created then the CLI gives a cryptic error even though the Managed Private Endpoint (MPE) gets successfully created (ofc still need to be approved).
fabric-cli version
1.2.0
Python version
Python 3.12.9
Operating System
Windows
CLI Mode
Command line mode
Authentication Method
Service principal (secret)
Steps to Reproduce
On an existing Fabric workspace create a Managed Private Endpoint on a Azure Resource using the CLI with a user that is not Authorized to read the private endpoints connections of that resource.
In my scenario I was creating a MPE to an Azure Key Vault with a SPN. The SPN has full admin rights to the workspace, but has no permissions on the AKV.
WORKSPACE_NAME="ws1.workspace"
PE_KEYVAULT_RESOURCE_ID="/subscriptions/XXXX/resourceGroups/myrg/providers/Microsoft.KeyVault/vaults/mykeyvault"
fab create ${WORKSPACE_NAME}/.managedprivateendpoints/mpe1.ManagedPrivateEndpoint \
-P targetprivatelinkresourceid=${PE_KEYVAULT_RESOURCE_ID},targetsubresourcetype=vault
Creating a new Managed Private Endpoint. It may take same time (waiting until provisioned)...
x create: [UnknownError] An unexpected error occurred while processing the request
β Request Id: d631414d-b63e-4fcd-afbc-d739346772c8This successfully creates the MPE, although this is unclear from the error. The error is caused here:
https://github.com/microsoft/fabric-cli/blob/7c7188c9633666ccd9a15fdbb1b1e6a922a84eca/src/fabric_cli/utils/fab_cmd_mkdir_utils.py#L736-L739
Traceback:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\gfranssens\vscode-projects\fabric-cli\src\fabric_cli\client\fab_api_client.py", line 167, in do_request
raise FabricCLIError(
fabric_cli.core.fab_exceptions.FabricCLIError: [Forbidden] Access is forbidden. You do not have permission to access this resource
HTTP Request response 403:
{
"error": {
"code": "AuthorizationFailed",
"message": "The client 'XXX' with object id 'XXX' does not have authorization to perform action 'Microsoft.KeyVault/vaults/privateEndpointConnections/read' over scope '/subscriptions/XXX/resourceGroups/myrg/providers/Microsoft.KeyVault/vaults/mykeyvault' or the scope is invalid. If access was recently granted, please refresh your credentials."
}
}
Expected Behavior
MPE was successfully created, however the status cannot be checked.
Actual Behavior
WORKSPACE_NAME="ws1.workspace"
PE_KEYVAULT_RESOURCE_ID="/subscriptions/XXXX/resourceGroups/myrg/providers/Microsoft.KeyVault/vaults/mykeyvault"
fab create ${WORKSPACE_NAME}/.managedprivateendpoints/mpe1.ManagedPrivateEndpoint \
-P targetprivatelinkresourceid=${PE_KEYVAULT_RESOURCE_ID},targetsubresourcetype=vault
Creating a new Managed Private Endpoint. It may take same time (waiting until provisioned)...
x create: [UnknownError] An unexpected error occurred while processing the request
β Request Id: d631414d-b63e-4fcd-afbc-d739346772c8Additional Context
No response
Possible Solution
Error handling when making the request to check the Azure resource.