Posted on Leave a comment

Azure AI Studio – Deploy and use your first model

Azure AI Studio is a trusted platform that empowers developers to drive innovation and shape the future with AI in a safe, secure, and responsible way. The comprehensive platform accelerates the development of production-ready copilots to support enterprise chat, content generation, data analysis, and more. Developers can explore cutting-edge APIs and models for their use cases; build and test solutions with collaborative and responsible AI tools, safeguards, and best practices; deploy AI innovations for use in websites, applications, and other production environments; and manage solutions with continuous monitoring and governance in production.

It is a matter of clicks to start using AI studio, you will need to deploy a new hub from Azure portal and then press Launch from the UI.

When you open the studio, you’ll see the user interface shown below. To get started, you’ll need to deploy your first model by navigating to the deployments section.

From deployments you have two options, either to deploy a base model or a fine-tuned.

At the time of writing there are 1747 models available from all kind of companies. In my case I selected the gpt-4o-mini and by pressing deploy I have an instance ready that I can use on the playground.

After your model is deployed you can start using your model by either using chat or assistant. Lets take assistant as an example.

By pressing New Assistant a name will be auto generated and you can start chatting with it.

A very handful functionality is the ability to generate code on how to use your AI. By pressing View code, you can request a sample on many languages like python and C#.

A snippet on C# can be found below.

Another useful functionality is the ability to deploy your chat model as a web app with just a few clicks. By navigating in the left menu inside Chat section you can use the Deploy button.

Then you should fill the information on where you want to deploy your web app and press Deploy.

When the deployment finishes you can find your web app inside the resource group that you specified.

Posted on Leave a comment

Azure Linux virtual machine not booting – disk issue

There could be cases that you have not configured the disk correctly inside a Linux azure virtual machine , or the disk mount point to change because of a disk increase. This circumstance will make your virtual machine fail and boot into emergency mode. In order to fix this issue you should first get a terminal windows on the Azure virtual machine as you cannot ssh. This can be done by selecting Help -> Serial Console

By checking the boot logs you can find the issue which in my case is the mounting of the data disk. The data disk is added as an entry on /etc/fstab but the mount point changed and Linux filesystem cannot locate it.

In order to resolve this issue you should mount the disk using the UUID to be 100% sure for the mount point. First locate the disk by using

fdisk -l

After locating the mount point run blkid command to find the UUID of the disk.

blkid

When you find the UUID use it in your /etc/fstab file instead of the mount point as shown below.

Posted on Leave a comment

Deploying kubernetes applications with 2-clicks | Azure DevOps & Terraform

When you read the title you may think that this article can be a clickbait. That’s the reason you should continue reading until this end to figure out that deploying k8s application with Azure DevOps and terraform can be very easy when you create everything through infrastructure as code.

In this example we will utilize Azure DevOps pipelines and terraform to deploy a yaml definition on an AKS cluster that runs on Azure. For this output we will need three steps.

The first step is to create an AKS cluster on Azure. When we have the infrastructure ready we can then continue and bind Azure DevOps pipelines with the AKS resource so that we can deploy on the cluster. The last step is to have the yaml definition of the application that we need to deploy and run the application deployment process inside azure devops.

The project is structure as shown in the below picture.

  • The code folder contains the yaml k8s definition file.
  • The iac_aks creates the AKS cluster inside Azure
  • The iac_devops creates the Azure Devops resources needed (Service connection with AKS)
  • And finally the azure-pipeline and application-pipeline are the pipelines that will run the automation and do the job.

In order to try out the example the first think that you need to do is to create a variable group inside azure devops and store two values. The first value will be the secret Personal access token that will be used to create the Azure DevOps resources. The second one is the URL of your Azure DevOps organization.

When those are set you will need to change the tfvars files and add the names that you prefer for the resources creation. Finally you can have your deployment ready with just two clicks. One for the infra pipelines and one for the application pipeline.

Code is hosted on Github
https://github.com/geralexgr/globalazuregreece2024

Posted on Leave a comment

Pass terraform provider variables as secrets

Many times you need to provide values in provider information when using terraform. Lets take as an example the below code block. The azuredevops provider needs some variables in order to deploy successfully and we need to pass those values as secrets because they contain sensitive information.

terraform {
required_providers {
azuredevops = {
source = "microsoft/azuredevops"
version = ">=1.0.0"
}
}
}

provider "azuredevops" {
org_service_url = URL
personal_access_token = TOKEN
}

We should never hardcode such information in the application as this information may get leaked. In order to pass those as secrets we will need to create a variable group or standalone variables and place the secrets there.

Then we will need to create some terraform variables and pass the values for those through the pipeline.

variable "org_service_url" {
description = "The URL of your Azure DevOps organization."
}

variable "personal_access_token" {
description = "The personal access token for authentication."
}

The provider block should be updated accordingly.

provider "azuredevops" {
org_service_url = var.org_service_url
personal_access_token = var.personal_access_token
}

Finally we pass those values through the pipeline step by providing those with -var argument on terraform.

    - task: TerraformTaskV4@4
displayName: terraform apply
inputs:
provider: 'azurerm'
command: 'apply'
workingDirectory: '$(System.DefaultWorkingDirectory)/src/iac_devops'
commandOptions: '-var="org_service_url=$(URL)" -var="personal_access_token=$(PAT)"'
environmentServiceNameAzureRM: 'SUBSCRIPTION'

Finally the pipeline will succeed.