Skip to main content
Version: 13.x (Current)


Create and use a Context

You can have one or more context locally for interacting with one or more installation fo Mia-Platform Console. Below you can find some examples on how to create multiple contexts and then selecting one of them.

Create a Context for a Company on the cloud instance:

miactl context set paas-company --company-id <your-company-id>

Create a Context for specific Project in a Company on the cloud instance:

miactl context set paas-project --company-id <your-company-id> --project-id <your-project-id>

Create a Context for connecting on a self hosted instance:

miactl context set example-console --endpoint

Create a Context for connecting on a self hosted instance exposed via a self signed certificate:

miactl context set example-private --endpoint https://console.private --ca-cert /path/to/custom/private/ca.crt

Use the context named paas-project:

miactl context use paas-project

List Projects

The list project command will list all Projects that the current user can access in the selected Company:

miactl project list

Or you can set a different Company via flag:

miactl project list --company-id <your-company-id>

Deploy Project

The deploy command allows you to trigger a new deploy pipeline for the current Environment in the Project. The only argument needed is the Environment ID that you want to deploy:

miactl deploy development --revision main

Additionally, if your context doesn’t contain the Project ID, you can select it via a flag:

miactl deploy development --project-id <your-project-id> --revision main

You can customize the way your Project is deployed:

miactl deploy development --no-semver --revision tags/v1.0.0

Deploy Project using a service account from a CD pipeline

The commands are the same used above in the Deploy Project section, but you need to use a Service Account for that. If you don't know how to create a Service Account, read the dedicated documentation.

The Service Account can be created with two different authentication methods:

  • Client Secret Basic: the service account authenticates by presenting its client_id and client_secret;
  • Private Key JWT: the service account authenticates by signing a JWT (JSON Web Token) using its private key.

After creating the Service Account, the first step to setup the miactl is create an auth context. With an auth context you can choose how to be authenticated with the Mia-Platform APIs in all your different contexts you create with the miactl.

Based on the authentication method of your Service Account, you can create the auth context with the following command:

  • Client Secret Basic:

    miactl context auth <miactl-auth-name> --client-id <sa-client-id> --client-secret <sa-client-secret>
  • Private Key JWT:

    miactl context auth <miactl-auth-name> --jwt-json <path-to-json-containing-the-json-config-of-a-jwt-service-account>

Now you can create the context you want use the miactl to.


Remember to specify the auth context to be used with the ---auth-name flag, otherwise the miactl will try to perform a user authentication through the default browser.

miactl context set <my-context-name> --endpoint https://console.private --company-id <my-company-id> --project-id <my-project-id> --auth-name <miactl-auth-name>

After that, just set the context as the used one:

miactl context use <my-context-name>

and deploy the pipeline:

miactl deploy development --no-semver --revision main

Finally, you can group the commands above and run them inside a pipeline, e.g. a GitLab pipeline:

# Insert that after your pipeline stages
stage: deploy

- miactl version
- miactl context auth deployer-sa --client-id sa-client-id --client-secret sa-super-secret
- miactl context set my-private-console --endpoint https://console.private --company-id id-of-my-company --project-id id-of-my-project --auth-name deployer-sa
- miactl use my-private-console
- miactl deploy DEV --no-semver --deploy-type smart_deploy --revision main