Connecting the Agent to the Data Platform
Connect the agent you registered in Immuta to your data platform so the agent can run queries on behalf of users
Databricks
Dependencies
--
-- System table used for data-only impersonation for OBO (on-behalf-of) agents
--
-- Primary keys are informational, not enforceable, in Databricks.
-- Uniqueness is enforced by the application layer via MERGE on vended_group.
-- vended_group is the logical primary key: one agent maps to one impersonated user at a time.
CREATE TABLE IF NOT EXISTS `<immuta system catalog>`.`immuta_system`.`__immuta_obo_agent_impersonation` (
vended_group STRING NOT NULL PRIMARY KEY,
impersonated_user STRING NOT NULL,
created_at TIMESTAMP NOT NULL
);
-- Enable default values so the created_at column can have a default
ALTER TABLE `<immuta system catalog>`.`immuta_system`.`__immuta_obo_agent_impersonation` SET TBLPROPERTIES('delta.feature.allowColumnDefaults' = 'supported');
-- Set the default value for created_at to the current time
ALTER TABLE `<immuta system catalog>`.`immuta_system`.`__immuta_obo_agent_impersonation` ALTER COLUMN created_at SET DEFAULT CURRENT_TIMESTAMP();
--
-- Revoke direct access from account users - only the Immuta service account should
-- read and write this table
--
REVOKE SELECT,MODIFY ON TABLE `<immuta system catalog>`.`immuta_system`.`__immuta_obo_agent_impersonation` FROM `account users`;
--
-- Transfer ownership to the Immuta service account
--
ALTER TABLE `<immuta system catalog>`.`immuta_system`.`__immuta_obo_agent_impersonation` OWNER TO `<immuta system account>`;
CREATE OR REPLACE VIEW `<immuta system catalog>`.`immuta_system`.`__immuta_user` AS
SELECT p.*
FROM `<immuta system catalog>`.`immuta_system`.`__immuta_profiles` p
LEFT JOIN `<immuta system catalog>`.`immuta_system`.`__immuta_obo_agent_impersonation` obo
ON upper(obo.vended_group) = upper(current_user())
WHERE upper(p.`immuta__userid`) =
CASE
-- OBO Agent Impersonation
WHEN obo.impersonated_user IS NOT NULL THEN upper(obo.impersonated_user)
-- Default Identity
ELSE upper(current_user())
END;Creating and mapping the agent account in Databricks
Connecting to Databricks as the agent
Ensuring the agent account can run queries
Snowflake
Dependencies
Creating and mapping the agent account in Snowflake
Connecting to Snowflake as the agent
Prerequisites
1 - Create a PAT scoped to the vended role
2 - Execute queries using the PAT
Ensuring the agent account can run queries
Last updated
Was this helpful?

