- App Registration in Azure
- Azure CLI on Windows
- Create a user using Terraform
- Azure CLI on Linux
App Registration to Access Azure
App registration needs
- Azure Active Directory
- Tenant
- Admin permissions to register
Note: Azure Active Directory is now Microsoft Entra ID
Go to App Registrations
Roles and Permissions
Install Azure CLI on Windows
Run powershell as Administrator
$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; Remove-Item .\AzureCLI.msi
Trying to Login using CLI
Login to a tenant
az login --tenant TENANT_ID
We should create a subscription
After subscription is created
Let’s try to create a new user using Terraform
Add this to main.tf
provider "azurerm" {
features {}
}
# Create an Azure AD user
resource "azuread_user" "example_user" {
user_principal_name = "admin@azure.iverique.com"
display_name = "Example User"
mail_nickname = "exampleuser"
password = "P@ssw0rd1234"
}
Run terraform
terraform init
terraform plan
terraform apply
We are having this error:
Solution: Go to Custom domain names and add your domain name
We created a user successfully.
You can read more about adding the custom name solution here:
Install Azure CLI on Linux (Ubuntu)
sudo apt install azure-cli
To unistall Azure CLI
sudo apt remove azure-cli
sudo apt autoremove
Login to Azure as Service Principal
az login --service-principal -u <app-id> -p <password-or-cert> --tenant <tenant>
Login to Azure Container Registry
sudo az acr login --name myregistry
Pull docker image from Azure Container Registry
You cannot pull this without being logged in.
sudo docker pull my-registry.azurecr.io/repository:tag