| title | sp_msx_set_account (Transact-SQL) | ||
|---|---|---|---|
| description | sp_msx_set_account sets the SQL Server Agent master server account name and password on the target server. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server]
Sets the [!INCLUDE ssNoVersion] Agent master server account name and password on the target server.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_msx_set_account
[ [ @credential_name = ] N'credential_name' ]
[ , [ @credential_id = ] credential_id ]
[ ; ]
The name of the credential to use to sign in to the master server. @credential_name is sysname, with a default of NULL. The name provided must be the name of an existing credential.
Either @credential_name or @credential_id must be specified.
The identifier for the credential to use to sign in to the master server. @credential_id is int, with a default of NULL. The identifier must be an identifier for an existing credential.
Either @credential_name or @credential_id must be specified.
0 (success) or 1 (failure).
None.
[!INCLUDE ssNoVersion] uses credentials to store the user name and password information that a target server uses to sign in to a master server. This procedure sets the credential that [!INCLUDE ssNoVersion] Agent for this target server uses to sign in to the master server.
The credential specified must be an existing credential. For more information about creating a credential, see CREATE CREDENTIAL.
Execute permissions for sp_msx_set_account default to members of the sysadmin fixed server role.
The following example sets this server to use the credential MsxAccount to connect to the master server.
USE msdb;
GO
EXECUTE dbo.sp_msx_set_account @credential_name = MsxAccount;
GO