# Create a cloud account

Source: https://www.jawsdeploy.net/rest-api/cloud-accounts-create | Section: Cloud Accounts

Register an Azure cloud account in a workspace.

`POST /api/cloud-account`

Creates a cloud account. Currently only `Azure` is supported - pass the service principal credentials in the `azure` sub-object. If `applyEnvironmentFilter` is true, the account is restricted to deployments targeting one of `environmentFilter`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `workspaceId` | body | string | yes | ID of the workspace. |
| `name` | body | string | yes | Display name. |
| `description` | body | string | no | Optional description. |
| `cloudType` | body | string | no | `Azure` (default). |
| `applyEnvironmentFilter` | body | boolean | no | Restrict use of this account to specific environments. |
| `environmentFilter` | body | array<string> | no | Environment IDs allowed to use this account. |
| `azure` | body | object | no | `{ subscriptionId, tenantId, applicationId, applicationPassword }`. |

## Errors

| Status | Meaning |
|---|---|
| 400 | Invalid `workspaceId`, invalid `cloudType`, or validation failure (e.g. bad environment IDs). |
| 401 | Missing or invalid Basic auth credentials, or the service account lacks the required role. |

Example request:

```
POST /api/cloud-account

{ "workspaceId": "ws_abc", "name": "Acme prod sub", "cloudType": "Azure", "azure": { "subscriptionId": "...", "tenantId": "...", "applicationId": "...", "applicationPassword": "..." } }
```

Example response:

```
{ "accountId": "ca_1" }
```

