Create the App registration
az ad app create --display-name <displayname> --homepage <home page url> --identifier-uris <Service Prinipal logon url> --password <Service Principal logon password>
...
Create the Service Principal and link it to the app.
az ad sp create --id <app id | identifier uri >
...
In this example the identifier uri is used.
...
...
Assign a role to the App.
az role assignment create --role <subscription role> --assignee <app id | identifier uri>
In this example the built-in role of Owner and identifier
...
url are used.
As an optional step login via the service principal can be validated.
az login –service-principal -u <identifier uri> -p <password> -t <tenant id | domain>
...
...
The service principal can now be used with SoftNAS