|

|  How to Integrate Microsoft Azure Cognitive Services with Jenkins

How to Integrate Microsoft Azure Cognitive Services with Jenkins

January 24, 2025

Learn to seamlessly integrate Microsoft Azure Cognitive Services with Jenkins for enhanced automation and AI capabilities in your development projects.

How to Connect Microsoft Azure Cognitive Services to Jenkins: a Simple Guide

 

Setup Azure Cognitive Services

 

  • Go to the Azure Portal and sign in with your Azure account.
  •  

  • Navigate to 'Create a resource'. In the search box, type 'Cognitive Services' and select it from the dropdown.
  •  

  • Click on 'Create'. Fill in the required information such as Subscription, Resource Group, Region, etc.
  •  

  • Under 'Pricing tier', select the appropriate tier for your requirements.
  •  

  • Review and then click 'Create'. It will take a few moments to create the resource.
  •  

  • Once created, go to the resource, and in the 'Keys and Endpoint' section, you will find your API endpoint and keys which you'll need later.

 

Install Jenkins and Required Plugins

 

  • Install Jenkins on your server. You can download it from the official Jenkins website.
  •  

  • Configure Jenkins by unlocking it using the password provided during the installation.
  •  

  • Install recommended plugins or manually select plugins based on your needs.
  •  

  • Ensure that Jenkins has access to the required Azure plugin. Go to 'Manage Jenkins' > 'Manage Plugins'. Search for 'Azure Credentials' and 'Azure SDK Libraries' plugins, and install them.

 

Configure Azure Credentials in Jenkins

 

  • Go to 'Manage Jenkins' > 'Manage Credentials'.
  •  

  • Select your preferred domain or 'Global' if you want these credentials to be available everywhere.
  •  

  • Click on 'Add Credentials'. Choose 'Microsoft Azure Service Principal' as the kind.
  •  

  • Fill in the Service Principal's credentials: Client ID, Client Secret, and Tenant ID. These are typically created in Azure Active Directory.
  •  

  • Test the connection to ensure they are correctly set up.

 

Integrate Azure Cognitive Services API in Jenkins Pipeline

 

  • Create a new pipeline job in Jenkins by selecting 'New Item' and then 'Pipeline'.
  •  

  • In the pipeline script, you can use the following simple script to access Azure Cognitive Services:
  •  

    pipeline {
        agent any
        stages {
            stage('Azure Cognitive Services') {
                steps {
                    script {
                        def azureServiceKey = "${YOUR_AZURE_COGNITIVE_KEY}"
                        
                        sh 'curl -X POST \
                            -H "Content-Type: application/json" \
                            -H "Ocp-Apim-Subscription-Key: ${azureServiceKey}" \
                            --data "{\'documents\':[{\'id\':\'1\', \'language\':\'en\', \'text\':\'Hello World\'}]}" \
                            https://<your-cognitive-service-endpoint>/text/analytics/v3.0/sentiment'
                    }
                }
            }
        }
    }
    

     

  • This script uses a simple curl command to send a POST request to the Azure Cognitive Service's text analytics API. Adjust the API endpoint and payload as per your specific needs.
  •  

 

Testing and Verification

 

  • Run the Jenkins pipeline to ensure everything is set up correctly.
  •  

  • Check the Jenkins build console output for any errors or confirmation that Azure Cognitive Services' API call was successful.
  •  

  • If the integration is successful, you should see a valid response from Azure Cognitive Services in the output.

 

Omi Necklace

The #1 Open Source AI necklace: Experiment with how you capture and manage conversations.

Build and test with your own Omi.

How to Use Microsoft Azure Cognitive Services with Jenkins: Usecases

 

Automating Content Moderation for User-Generated Content

 

  • Deploy Microsoft Azure Cognitive Services to handle content moderation by analyzing images, videos, or text streams for inappropriate content in real-time.
  •  

  • Utilize Jenkins to automate the integration and testing process, ensuring that any new or updated moderation algorithms are swiftly and correctly deployed.
  •  

  • Automatically run Jenkins builds that integrate new changes or enhancements to the moderation logic, such as updated language models or enhanced image identification capabilities.
  •  

  • Create a Jenkins pipeline that executes a suite of automated tests ensuring that content moderation service improvements do not degrade existing functionality or introduce errors.
  •  

  • Use Jenkins to schedule regular updates and deployments of the content moderation algorithms, leveraging Jenkins’ capability to seamlessly handle dependencies and deployment pipelines.
  •  

  • Streamline notification processes between Jenkins and Azure, alerting relevant teams about the status of builds and deployments, ensuring that any issues are promptly addressed.

 

```shell

Clone the repository

git clone https://github.com/yourrepository/content-moderation.git

Change directory to the project folder

cd content-moderation

Run Jenkins build

jenkins build yourJobName

```

 

 

Enhancing Speech Recognition Accuracy with Continuous Integration

 

  • Integrate Microsoft Azure Cognitive Services' Speech Recognition API to transcribe user-generated audio files into text for further processing and analysis.
  •  

  • Leverage Jenkins to automate the continuous integration and deployment process, ensuring that any improvements in the speech recognition models or new features are quickly and accurately rolled out.
  •  

  • Set up Jenkins to automatically pull the latest modifications in the speech recognition logic, such as newly trained models or optimized audio processing techniques, triggering subsequent build processes.
  •  

  • Design a Jenkins pipeline to deploy and test new speech recognition features on a staging environment, validating enhancements in accuracy, latency, and resilience without impacting the production system.
  •  

  • Utilize Jenkins to manage dependencies and coordinate test runs, making sure that any updates to the speech recognition service do not detract from existing performance or accuracy metrics.
  •  

  • Enable automated alerts via Jenkins to notify technical teams of build outcomes and deployment states, facilitating swift responses to any emergent issues across the speech recognition services.

 

```shell

Access the project directory

cd speech-recognition-project

Execute Jenkins pipeline for continuous integration

jenkins build speechRecognitionJob

```

 

Omi App

Fully Open-Source AI wearable app: build and use reminders, meeting summaries, task suggestions and more. All in one simple app.

Github →

OMI NECKLACE + OMI APP
First & only open-source AI wearable platform

a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded a person looks into the phone with an app for AI Necklace, looking at notes Friend AI Wearable recorded
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
online meeting with AI Wearable, showcasing how it works and helps online meeting with AI Wearable, showcasing how it works and helps
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded
App for Friend AI Necklace, showing notes and topics AI Necklace recorded App for Friend AI Necklace, showing notes and topics AI Necklace recorded