Requesting Authorization
The Veeam Backup for Microsoft Azure REST API accepts several grant types to authenticate a Veeam Backup for Microsoft Azure user:
You can configure single sign-on (SSO) settings in Veeam Backup for Microsoft Azure and retrieve user identities from your identity provider. To authenticate a user retrieved from the identity provider, the Veeam Backup for Microsoft Azure REST API uses single sign-on authorization. For more information on configuring SSO settings, see the Configuring SSO Settings section of the Veeam Backup for Microsoft Azure User Guide.
To obtain authorization tokens, a user sends the HTTP POST request to the /api/oauth2/token endpoint.
The request body must contain the grant_type parameter with the specified Password value and the credentials of a user created in Veeam Backup for Microsoft Azure. For more information on how to create users, see Users or the Veeam Backup for Microsoft Azure User Guide, section Managing Permissions.
A successfully completed operation returns the 200 response code. In the response body, Veeam Backup for Microsoft Azure returns an access token, its expiration time (in seconds) and a refresh token. The user inserts the access token in headers of further requests to the Veeam Backup for Microsoft Azure REST API. The refresh token must be saved locally.
To learn how to authorize your access using the Password grant type, see Example [Password]. Alternatively, you can use the Swagger UI.
Note |
MFA is disabled by default. To learn how to enable MFA, see Multi-Factor Authentication or the Veeam Backup for Microsoft Azure User Guide, section Managing Permissions. |
If multi-factor authentication (MFA) is enabled for a user, the user must first obtain an mfa token, and then get authorization tokens.
- To obtain an mfa token, the user sends the HTTP POST request to the api/oauth2/token endpoint. The request body must contain the grant_type parameter with the specified Password value and the credentials of the user.
A successfully completed operation returns the 200 response code. In the response body, Veeam Backup for Microsoft Azure returns an mfa token.
- To obtain an access token and a refresh token, the user must send another HTTP POST request to the api/v3/token endpoint. The request body must contain the grant_type parameter with the specified Mfa value, the mfa token previously received from the authorization server, and the verification code generated by an authentication application on the trusted device.
A successfully completed operation returns the 200 response code. In the response body, Veeam Backup for Microsoft Azure returns an access token, its expiration time (in seconds) and a refresh token. The user inserts the access token in headers of further requests to the Veeam Backup for Microsoft Azure REST API. The refresh token must be saved locally.
To learn how to authorize your access using the MFA grant type, see Example [MFA]. Alternatively, you can use the Swagger UI.
- To get authorization using single sign-on, a user must first send the HTTP POST request to the /api/v3/settings/saml2/idp/register endpoint. The request body must contain the content of the metadata file obtained from the identity provider.
A successfully completed operation returns the 200 response code.
- To obtain metadata from your service provider, send the HTTP GET request to the /api/v3/settings/saml2/sp/metadata endpoint.
A successfully completed operation returns the 200 response code. In the response body, Veeam Backup for Microsoft Azure returns metadata file.
- To obtain the SSO URL, a user sends the HTTP GET request to the /api/v3/settings/saml2/idp endpoint.
A successfully completed operation returns the 200 response code.In the response body, Veeam Backup for Microsoft Azure returns the entityId and loginUrl, that will be used to get an SSO URL and start SSO login process.
- To start the SSO login process, send the HTTP GET request to the /api/v3/settings/saml2/idp/authenticate endpoint. Insert identity provider ID and login URL to the request body.
A successfully completed operation returns the 200 response code.In the response body, Veeam Backup for Microsoft Azure returns the redirect SSO URL.
5. To finish SSO settings configuration, a user must pass the service provider authentication settings to the identity provider. To obtain the settings, send the HTTP GET request to the /api/v3/settings/saml2/sp/metadata endpoint.
A successfully completed operation returns the 200 response code and a metadata file with the service provider authentication settings.
Alternatively, you can copy the service provider settings manually. To do that, send the HTTP GET request to the /api/v3/settings/saml2/sp/metadata endpoint. A successfully completed operation returns the 200 response code. In the response body, Veeam Backup for Microsoft Azure returns an ID of the identity provider and login URL.
Tip |
If you want to sign and encrypt authentication requests sent from Veeam Backup for Microsoft Azure to the identity provider, you must select a certificate with a private key that will be used for encryption and signing:
|
To obtain an access token and a refresh token, a user sends the HTTP POST request to the api/oauth2/token endpoint. In the request body, the user specifies the following parameters:
The server sends a response in the following format.
|
To access the REST API when MFA is enabled, a user must do the following:
In the request body, the user specifies the following parameters:
The server sends a response in the following format.
In the request body, the user specifies the following parameters:
The server sends a response in the following format.
|