Modern DevOps is in the process of transforming from traditional or ‘classic DevOps’ to an AI-driven discipline that will reshape the industry in the coming decade. The first wave of digital transformation in DevOps focused on rapid development, responsiveness to change, and dynamic, faster delivery to the market.
However, with the integration of AI into DevOps workflows, ushering in the ‘AIOps’ era, this new approach promises to further streamline processes, reduce implementation time, and accelerate the discovery and resolution of issues.
In my previous blog, I examined how AI is modernising DevOps. In this blog, I'll explore a real-world use case that highlights how the integration of AI, specifically through the use of GitHub Copilot, can transform the process of creating user profiles in Azure DevOps. I'll walk through the step-by-step journey, highlighting the benefits of this AI-driven approach and the remarkable time savings it achieved.
Automating User Profile Creation in Azure DevOps
This example involves a community of over 100 members, each requiring a unique profile to be created in Azure DevOps. A task that if done manually would consume a staggering 266 working hours.
A more efficient approach would be to automate the process. By developing a PowerShell script to streamline profile creation, the time required could be reduced to just 55 working hours—a significant improvement.
This process can be further enhanced through AI, however. GitHub Copilot, an AI-powered coding assistant, can redevelop the PowerShell script, ensuring it incorporates the latest changes and requirements.
Harnessing the Power of GitHub Copilot
The first step is to open the existing Azure DevOps repository in Visual Studio Code and select a sample profile to provide context for GitHub Copilot. Then engage the AI assistant by prompting it to "Create a PowerShell script to generate the markdown #selection."
Copilot will then generate an initial script using the data from the open file. However, the script may need to read the user information from an external data source, such as a CSV file, making it more dynamic and versatile.
Utilising the iterative nature of the Copilot workflow, the script can be refined with additional prompts:
- "Read all values from a CSV file"
- "Adjust the script to create multi files for multi users"
- "Adjust the script to change the files name structured as the following: ($SubscriptionID)-($AKA).md Where the spaces in the AKA are replaced with dashes."
With each prompt, Copilot will update the script, incorporating the requested features and transforming the manual process into a streamlined, AI-driven automation.
The final PowerShell script, generated with the assistance of GitHub Copilot, is both efficient and flexible. It can read user information from a CSV file, generate the necessary markdown content for each profile, and save the profiles as individual files with a custom naming convention.
You can find the final script at the bottom of this article.
The script's key features include:
- Reading user information from a CSV file
- Replacing spaces in the "AKA" field with dashes to conform to the naming convention
- Dynamically generating the markdown content for each user profile
- Writing the markdown to individual files with the naming format: "($SubscriptionID)-($AKA).md"
By leveraging an AI-powered script, the overall time required for user profile creation is reduced from 266 working hours (manual) to just 5 working hours (AI-assisted automation) – a staggering 95% reduction in development and operation time.
Best Practices and Lessons Learned
The success of this use case highlights the importance of effectively leveraging AI tools like GitHub Copilot within the DevOps ecosystem. Some key best practices and lessons learned include:
- Effective Prompting: Mastering the art of prompting is crucial for extracting the most value from AI assistants. An iterative approach, refining prompts based on a script's evolving requirements is crucial as is clear and targeted communication with the AI.
- Balancing AI and Human Expertise: While AI can significantly enhance efficiency, it's essential to maintain a balance between AI-driven automation and human oversight. In our example the final script required careful review and input in order for it to meet specific requirements.
- Integrating AI into Existing Workflows: This use case's success lies in the seamless integration of the AI-powered script into an existing Azure DevOps workflow. This highlights the importance of aligning AI-driven solutions with existing processes and systems.
Unlocking the Potential of AI in DevOps
The integration of AI into DevOps is transforming the software delivery landscape, making processes faster, more efficient, and more reliable. The use case with GitHub Copilot showcases the remarkable potential of AI-driven automation, where tasks that once took months can now be completed in a matter of hours or even minutes.
As the software industry continues to advance, the partnership between AI and human expertise will be crucial for driving innovation and maintaining a competitive edge. By embracing the power of AI tools like GitHub Copilot, organisations can streamline their DevOps workflows, freeing up valuable time and resources to focus on delivering high-quality software solutions that meet the ever-changing demands of the market.
If you would like to find out more, please reach out to us today to arrange a consultation.