on 15-Mar-2022 09:00
Before jumping straight into the code, we should layout the activities that we will need to explore as well as the goal of this script as a composite. The basic objective will be to take a deployed F5 Big-IP that has only a management IP address and after completion be a fully deployed Big-IP with an example Virtual IP (VIP) and Pool. The configuration will be purposes terse, as the goal is less about complex configuration and more how to perform these actions with PowerShell. These objectives can be broken down as follows:
Part 5 of this series will provide some final thoughts on where the code can be evolved.
Initially, I had wanted to include a section that would focus on using Visual Studio Code to work with the declarations, and PowerShell code if desired. After completing the bulk of this content it became clear that the Visual Studio Code content would be best covered in an independent and focused article. However, I will make a few points here in brevity that I feel are critical:
If you are not using Visual Studio Code (VS Code) to interact with your Big-IP systems, you should take a little time and familiarize yourself with VS Code and The F5 Extension. This was initially a replacement for the iRule editor that F5 used to distribute but has evolved into a much more powerful tool. This was discussed at the top of this article, but I want to emphasize that all the code and declarations for this article were constructed and tested using VS Code exclusively. The declarations can be written, syntactically verified, and uploaded to a Big-IP system and the return data is easily displayed for interrogation. I would personally accept no alternative when crafting declarations.
I also used VS Code for the PowerShell cookbook; however, I will concede that there are other tools and resources that are likely popular alternatives. The integration of source control and having all your automation maintainable within a single tool is compelling and if you need to build an extensive framework you should carefully assess these tools in keeping your architecture streamlined.
Lastly, if you are not a ‘code monkey’ and developer IDEs are things you try to avoid I would encourage you at least peek at VS Code and The F5 Extension. While its real power lies in scripting, development, automation, and other data manipulation there are tools to more traditional users that are also valuable.
Throughout the creation of this content, I discovered and evolved some of my thinking on how to craft the requests and returns, which should be evident when looking through the code. I resisted going back and updating earlier parts of the code purposefully both for clarity and to present some alternatives in your approach. This code can be vigorously refactored for a more enterprise level approach. A few ideas would be: