I have been studying OMS for a while now and although there is gradually more and more content about it, here’s another piece of code that can help you with your daily OMS management.
If you don’t know what OMS is, go here.
If you do, you may know that you can save searches that you find interesting and even add them to your workspace for future or daily use.
The problem comes when you need to move your searches to another environment. You don’t want to create hundreds of queries manually in the portal.
Enters PowerShell. You can find the documentation on the initial setup here. With a great start from Richard Rundle from Microsoft, I have completed the script to export the Saved searches.
Once you have Chocolatey and armclient configured, you can go ahead and use the script below.
Here’s a little walkthrough.
1. As soon as you run it,
you will be prompted by the login screen:
If you are like myself, using a user that has access to multiple tenants, you’ll be prompted for the tenant:
You will be then prompted for the subscription:
The script will show you a list of queries you may want to extract and then extract the ones that match a certain criteria specified in the script:
The criteria is the name of the Category:
And as you can see, the queries following the lists match that category only:
The script will also create a file named after the search category
Keep that file handy, since we are going to use it in the next article, to import the searches into another environment.
You can find the script here.
Keep on rocking in the cloud world!