ChainLink automation enables conditional execution of smart contracts functions. However, when calling function from the smart contract, it is the ChainLink registry contract that calls the function, and not the address that registered the UpKeep.

Therefore, it is likely that the call will fail if the function to call has a require that forces the caller (msg.sender) to be a given address (admin address for example).

Is it possible to automate such kind of functions (with msg.sender set to a needed address) with ChainLink Automation ?

As an example:

mapping() private _balance;
address public admin;

constructor {
    admin = msg.sender;
}

modifier onlyAdmin {
    require(msg.sender == admin, "Only admin");
    _;
}

function pay(address _account, uint256 _amount) public onlyAdmin {
    _balance[_account] += _amount; 
}

function getBalance(address _account) public view returns(uint256) {
    return _balance[_account];
}

update a balance through Chainlink automation. I expect the balance of _account to update to its previous value + _amount.

2

There are 2 best solutions below

1
On
_balance[account] = _balance[account] + _amount;
5
On

As you said transaction sent by Chainlink automation is signed with Chainlink Registry contract, and as far as I know it is impossible to replace the signature with consumer contract's owner's signature.

I think the better way to do this is to modify the modifier onlyAdmin to add address of registry contract.