-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added baseline for getting Azure Resource Role Assignments (#764)
This pull request adds a new command `save-azure-storage-accounts` to the UCX CLI tool. This command identifies all storage accounts used by tables in a HMS metastore, identifies the corresponding service principals and their permissions on each storage account, and saves the data in the CSV file on workspace. The new method `AzureResourcePermissions.save_spn_permissions` performs this functionality. Additionally, the pull request adds the `AzureResources` class, which is used to fetch information about Azure resources such as subscriptions, storage accounts, and containers. The `AzureRoleAssignment` and `Principal` classes are also added to represent role assignments and their associated principals. Changes related to tests include: * Test cases are added for the new `save-azure-storage-accounts` command, including tests for valid and invalid subscription IDs, as well as tests for cases where there are no external tables, no Azure storage accounts, or no valid Azure storage accounts. * The test case for `test_azure_spn_info_without_secret` is updated to use the `create_autospec` function to create a mock `WorkspaceClient` object instead of creating a mock object manually. * The `test_move` function is updated to use the `patch` decorator to patch the `TableMove.move_tables` method instead of using a mock object. * The `test_save_azure_storage_accounts_no_ucx` test case is added to test the behavior when UCX is not installed. * The `test_save_azure_storage_accounts_not_azure` test case is added to test the behavior when the workspace is not on Azure. * The `test_save_azure_storage_accounts_no_azure_cli` test case is added to test the behavior when the Azure CLI authentication method is not used. * The `test_save_azure_storage_accounts_no_subscription_id` test case is added to test the behavior when the subscription ID is not provided. --------- Co-authored-by: Hari Selvarajan <hari.selvarajan@databricks.com>
- Loading branch information
Showing
6 changed files
with
796 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.