Nautobot ChatOps Adds Support for Socket Mode in Slack

Blog Detail

The Nautobot ChatOps plugin just recently received a new feature for Slack that has been requested for a long time. If you are using Nautobot ChatOps plugin v1.10.0 or greater with Slack, you now have the ability to use Slack’s socket mode for connecting compared to their traditional webhook method!

In this blog post, we will dive into what exactly this means, how you can leverage socket mode, and why you may want to use it over the current method of connecting. Let’s dive in!

How Does ChatOps Connect Today?

Nautobot ChatOps today currently supports four major platforms: Slack, Microsoft Teams, Webex, and Mattermost. All four of these platforms support incoming webhooks, so this is the default setup method for them.

Let’s take a look at how this traffic flow currently works using this diagram from the official documentation page.

  1. When a user sends a message to the bot via the client application (phone or desktop app), the connection is initiated from the client, and the message gets sent to Slack’s cloud servers.
  2. The Slack servers then initiate a connection to the ChatOps plugin running on the Nautobot server/container.
  3. Since this is a new incoming connection, it must be port forwarded and allowed through any firewalls in your network between the internet and your Nautobot server.
  4. Since your externally facing firewall is stateful, Nautobot then replies back to Slack using the established TCP session.
  5. Slack then returns the response to the client.

The important step to notice here is step 3. In order for Slack’s web services to communicate to Nautobot with the request originating from the user/client, traffic must be explicitly allowed inbound. Normally this wouldn’t be much of an issue on a firewall. However, the issue is made more complicated for three reasons:

  1. A port must be opened and forwarded from the public internet to your Nautobot appliciation.
  2. It is not viable to simply white-list Slack’s IP addresses as the API requests originate from within AWS, so the IP ranges are quite extensive and will encompass other services on AWS besides Slack (aka the rest of the internet).
  3. Slack requires a valid Third-Party SSL Certificate before it will make the connection.

There are a few ways to secure inbound ChatOps access from Slack, such as adding verification that the webhook is legitimate, using an externally facing API Gateway, etc. One example Nautobot currently uses is verifying all inbound requests from Slack using a signed secret.

While we won’t get into all of them here, you can read about some of them in Slack’s documentation “Best practices for security”.

In the end, this still requires enabling inbound access from the public internet to your internal Nautobot instance, which tends to make InfoSec a little nervous.

Introducing socket mode.

What Is Socket Mode?

Socket mode allows traffic to no longer originate from Slack on the public internet, but instead from internally going out.

  1. The Nautobot server initiates and maintains a connection to the Slack cloud servers. Because the traffic originates from inside the network, externally facing firewalls do not need to allow inbound traffic from Slack to the Nautobot server. They only need to allow traffic outbound from the Nautobot server to Slack on the internet. This connection remains open through this entire process.
  2. A user will send a message via their desktop/mobile Slack client to the Nautobot ChatOps bot.
  3. Slack forwards the message to Nautobot over the existing WebSocket connection.
  4. Nautobot then replies over the existing WebSocket connection to Slack.
  5. Slack forwards the response to the client.

This reduces the externally facing Nautobot footprint out to the internet and does not require opening specific inbound access to Nautobot from the internet just to get ChatOps working.

Additionally, once Nautobot establishes a connection to Slack it keeps the connection active, eliminating the need to reestablish a new connection each time (as with webhooks).

Should I Use Socket Mode?

Either setup option works for Nautobot ChatOps with Slack. However, with the number of customers we’ve worked with at NTC that express concern over exposing Nautobot to the public internet and do not have an API gateway they can leverage to lock down inbound access, we expect to see many users prefer to use socket mode for security and compliance reasons.

If you currently have Nautobot ChatOps working with Slack, there is no real need to move over to socket mode. However, if you are setting it up new for the first time and your InfoSec team has concerns with enabling inbound access, socket mode may work better for your situation.

Setup Instructions

Support for socket mode with Slack was added to Nautobot v1.10.0, so if you are on an older version you will need to upgrade your Nautobot ChatOps plugin first. Since this plugin acts independently from other Nautobot ChatOps extensions (e.g., Meraki ChatOpsAnsible ChatOps, etc.), configuring this base plugin for socket mode will enable these other plugin extensions to leverage it as well without needing to specifically upgrade them (provided no other dependency conflicts exist).

Instructions for setting up Nautobot ChatOps for Slack can be found here. Note that the Nautobot application requires an additional management command to be run at startup time, nautobot-server start_slack_socket, which can be added as a systemd service so it automatically runs each time the app is restarted. Details can be found in section “Startup Slack Sockets”.

There is also an additional credential slack_app_token needing to be added to the Nautobot ChatOps plugin config section in nautobot_config.py. Details for this are found in section “Post App-Creation Steps” in the install docs as well.

Note: While socket mode support is only added to the Slack platform so far, we are working on adding in support for socket mode with the other providers (where supported) in the future.


Conclusion

I hope you enjoyed learning about our new support for socket mode with Slack. If you try it out, let me know what you think of it using the comment section below. Or feel free to submit a feature request, bug report, or even a code contribution via PR in our Nautobot ChatOps plugin public repo on GitHub.

 

Thanks for reading, and happy automating!

-Matt



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!

Overcoming Impostor Syndrome in IT

Blog Detail

Today I want to talk about something different: something nontechnical and not specific to network automation, but in the end just as important to us in IT, in Networking, and as Network Automation Engineers. I would argue that it is even more important than anything technical I could possibly write about. Today I want to talk about Impostor Syndrome, the thoughts and feelings associated with it, and how it affects me and so many of us personally and professionally.

I Bet I Know You

Odds are I’ve never met you before, but if I were a betting man, I’d wager I know you pretty well. Let me take a guess.

Like me, you’re an impostor. You work hard every day, but live on the edge of your seat, ready to be found out by your boss or your peers. You have no idea why you are as successful as you are. It’s a fluke. It’s luck. It’s a mistake. It doesn’t matter what you’ve accomplished, as it’s only a matter of time until you are found out as the impostor you really are. You don’t know how you got to your current position in your company or (perceived) level of expertise, but it definitely is not because you are qualified. It’s because you have managed to somehow trick every single person along the way into thinking you are competent. But only you know and can see the truth. It’s all a lie. You’re an impostor.

If we’re being honest here, I’d bet I am pretty accurate with most of you reading this. In fact, I’d love it if you commented below how accurate I am. When I first read a description similar to this, I was floored with how closely I could relate to it.

My Personal Journey

I’ve been in the networking world since 2007, and really got into scripting and automation around 2016-2017. But as I’ve progressed in my career, my struggle with impostor syndrome has only increased, not decreased; which is strange, because one would think it would be the opposite.

It doesn’t make any sense! I’ve been involved in Networking for over fifteen years, and have grown in my technical skills, accomplishments, seniority, knowledge, and experience. So why do I feel like more of an impostor than I did five years ago? Why did I not feel like an impostor back in 2007, first entering into IT? When I first started out, I was young, fresh, and eager to learn. Those traits are still there, the fear of failing and being an impostor wasn’t there initially. It has grown and developed over time. Why is that?

In order to answer this question further, as well as to understand and overcome my own impostor syndrome, I started digging into this about a year ago. What I’ve learned has helped me immensely, has already helped other people with whom I’ve discussed this, and now I’m hoping it will help everyone who reads this.

Note: One of my main resources I used to understand impostor syndrome came from the book The Imposter Cure by Dr. Jessamy Hibberd. It was a very helpful resource for me, and throughout this blog post, I will be referencing things I’ve learned from this book. I encourage you to read it as well.

Understanding Impostor Syndrome

Before we can fix any problem, technical or otherwise, we must first understand it. Think about it. How can anyone troubleshoot a routing loop without first having a fundamental knowledge of what networking is, what routing is, or even the OSI model? The same goes with Impostor Syndrome.

I’ll start us off with a great quote from Ted Lasso, the star in one of my favorite TV shows.

What Is Impostor Syndrome?

My definition of Impostor Syndrome is:

  • The feeling of being a fraud.
  • The feeling that you are not as good as other people perceive you to be.
  • The feeling that you are not worthy of the success you have currently attained.
  • The feeling that it’s only a matter of time until other people realize what you’ve known all along.

Impostor Syndrome is all about feelings, not necessarily facts. If you noticed in my summary definition, the root feeling in all of these is fear. In fact, we can rewrite the above bullet points more accurately:

  • The fear of being a fraud, and perceived as such by others.
  • The fear of not being as good as others think, and living up to their expectations.
  • The fear of losing all of the success you’ve accomplished as soon as you stop being able to hide your impostor self.
  • The fear that other people will see through you.

What Triggers These Feelings?

While we impostor tend to have those thoughts and feelings on a regular basis, there are times when these thoughts and feelings are more pronounced than others.

Most impostors tend to be people pleasers, so events that happen that influence other people’s perception of you can really bring on this feeling of being an impostor. Notice I didn’t say “influence negatively,” because even positive events can trigger this. For example, have you succeeded at a project recently or accomplished something big at work, and maybe even received recognition for it? How did you feel?

If you’re like me, you think things like “They didn’t notice all the mistakes I made,” or “I could have done better,” or maybe even “How am I going to keep up this level of work?” My personal (least) favorite one I tell myself is “I can never replicate this level of success again.”

Other big triggers of Impostor Syndrome are during times of transition. This can include times when we get a promotion, or get a new job, or even just start a new project in our current role. Times of transition are fraught with change and uncertainty, which, understandably though not correctly, increase feelings of anxiety, insecurity, and self-doubt.

Changing jobs or roles can also cause feelings of insecurity around your current level of knowledge and/or skills. Think of it like this. Do you remember when you started at your current job? If it’s been less than a year, think back to your most recent job you held for over a year.

How did you feel? Did you know anything at all? Did you break something? I have, many times! Big, important things that I did, not because I was incompetent or incapable of learning, but because I was new. However, I’ll save those stories for another blog post.

Yet I look back after working somewhere for over a year and I am so much more confident and comfortable in my role and in my daily job. A place I literally could never have imagined getting to in my first three to six months at a new company. Yet I still felt like an impostor when starting out, even knowing I was new, and knowing everyone else knew I was new, and that all of the struggles of learning a new job are fully expected.

In the same breath, I’ve never been overly critical of any new hire, nor have I seen others be. I expect them to ask questions, to take longer to solve a problem, and to not know how to log into anything. In fact, if they don’t ask questions, they may even come across negatively as too confident or not open to learning and adapting to the role.

The Impostor Cycle

In Dr. Hibberd’s book The Imposter Cure, she describes a negative reinforcement cycle of Impostor Syndrome before proposing an alternative way of looking at it.

Negative Reinforcement Cycle

We can see here how most feelings that start with the impostor idea of “I don’t know what I’m doing” lead to discomfort, anxiety, and feelings of being an impostor. These in turn push us towards saying or thinking negative things about ourselves, and an unhealthy drive for an unattainable perfection that only exists in our minds. These then lead to either overworking ourselves, avoiding work altogether, or sometimes both!

Even when we do encounter success, we discount it for any number of reasons. She lists out some common ones. I can personally relate to most of them at some point or other in my life. How about you? Do any of these sound familiar?

  • I got lucky
  • It was a fluke
  • I’m a good actor
  • It was nothing
  • I had a lot of help
  • I just worked really hard
  • If I can do it anyone can
  • They’ve made a mistake
  • They felt sorry for me
  • I was in the right place at the right time
  • No one else wanted to do it
  • It’s only a matter of time before I’m found out

Breaking Out of the Impostor Cycle

One of the main topics Dr. Hibberd discusses is that the cycle begins with a feeling. The feeling of discomfort, anxiety, self-doubt, and that you don’t know what you’re doing.

Feelings are not facts.

Feelings are only just that: feelings. They may seem like facts when they come from within, but they are absolutely not facts. Once we can recognize this, we can start to rewrite this cycle into a more positive one, enabling us to break out of the impostor syndrome cycle.

Positive Reinforcement Cycle

We see here that she keeps the feelings of not knowing what we’re doing, discomfort, and anxiety. These are completely normal feelings for anyone in a new or difficult situation. But we need to recognize these feelings for what they are: feelings, not facts. Once we do, we can question these feelings a little further. Are they really grounded in truth? Or are they simply a by-product of my discomfort and anxiety?

One of the things that helped me the most when working on my own impostor syndrome was to talk to my peers about it. No, seriously! The best antidote to shame and anxiety and feelings of inadequacy is to “bring it out into the light,” or talk about it with others.

This was extremely hard at first, but got easier the more I did it. To my surprise, nearly everyone I brought this up to felt similarly and had no idea that others felt the same way too.

Impostor syndrome lives and grows in darkness and isolation. The more we realize we are not alone, the less of a stranglehold it has on us.

I strongly encourage you to do the same. If you like, or maybe just feel more comfortable in doing so, I welcome you to contact me directly. I can be reached by my handle @mattv on Network to Code’s public Slack org, or by email at matt.vitale@networktocode.com.

Identifying Impostor Syndrome

There are many characteristics you may be familiar with as an impostor, but there are three I personally feel strongly most of the time. They are Confirmation Bias, Overworking, and Avoidance.

Confirmation Bias

Confirmation Bias is essentially seeking out and/or favoring information that already supports our existing expectations and beliefs. We are so certain that we are right in being an impostor, and everyone else around us is wrong, that no amount of evidence otherwise could possibly be true.

We reject any positive information as untrue, either through explaining why it’s wrong, pointing out minor mistakes instead of bigger successes, or just flat out rejecting it.

However, negative information of any type, size, or validity is welcome. We grab hold of it, hold on for dear life, and use it to reinforce our already existing belief that we are, in fact, an impostor. To an impostor like me, even the most minor amount of constructive criticism can be devastating. This is where that comes from.

Once again, Dr. Hibberd does a great job identifying a “Confirmation Bias Cycle” in her book.

This cycle leads to the next two items: overworking and avoidance.

Overworking

When I feel like I’ve been given a task or project that I am not good enough to do, or not experienced enough in, I tend to compensate by overworking. I’ve worked 10+ hours straight, not because I had to, but because I felt like if I didn’t, the work wouldn’t get done correctly and everyone would see how bad I am at my job. The project would flop, I’d get fired, and down the rabbit hole I would go again with all of the negative “what if” scenarios.

In reality, I do a good job when I am at work. I work hard, try hard, and continuously work to better myself (e.g., reading The Imposter Cure). I learned that all overworking does is stress me out way more than it actually helps. It detracts from my very valuable time I have left in the day with my family, my hobbies, or just general self-care.

Avoidance

When I feel overwhelmed with a task, I avoid it. I used to think it was purely because I was lazy. Maybe back in high school, but it’s not the case anymore! Now it’s avoiding because of fear of the task itself, and not doing a good enough job at it.

I even caught myself doing it with this blog post. It was so subconscious, I didn’t realize it at first until I detached for a minute and really thought about it. I avoided starting to work on this blog post for over a month after committing to doing it to Jason Edelman, the literal founder and CTO of Network to Code, for fear of not living up to my own internalized expectations on the quality of this post. Thank you once again, impostor syndrome!

Overcoming Impostor Syndrome

I’ve spent a lot of time discussing Impostor Syndrome, what it is, and some of the ways I have recognized it within myself (and hopefully you can as well). As I mentioned before, I personally believe it’s as important to build a good foundation of what something is, and being able to recognize it when it does come up, before I can ever start to work on it.

So now let’s discuss some strategies around dealing with it, and eventually overcoming it. I have begun my journey of overcoming impostor syndrome, and you can as well! I’ll go over some of the ways that have worked for me that you may want to give a try.

I’ll start off with a great tweet from Adam Grant that I found very helpful.

So let’s take his advice and start with believing in our own ability to learn about this nontechnical topic.

The Journey

You’ll notice I said “begun my journey” earlier, and not that I have overcome it. That’s because this process is a journey that takes time and effort to overcome, one step at a time. I still fall into the impostor syndrome trap on a regular basis. However, over time it has gotten easier to both identify it when it happens and occurs less frequently than it used to; and I am better able to leverage some of my strategies to deal with it.

Strategies

9 Ways to Cope with Imposter Syndrome

Lindsay Kolowich Cox wrote a great blog post titled “9 Ways to Deal With Imposter Syndrome Before It Hinders Your Success”. In it, she outlined nine great ways to cope with impostor syndrome. I’ll briefly go over some of them here, but her blog post is worth a read, as she goes into a lot more detail on these nine steps.

  1. Just knowing the signs of what impostor syndrome is can really help when it occurs, as we can recognize some of the negative feelings as being related to impostor syndrome, or some of the thoughts that come up in our head as well. When I realize I’m feeling or thinking that way, it’s easier for me to move from the negative to the positive impostor cycle I mentioned earlier.
  2. Knowing you’re not alone is so critical to overcoming this. One of the things that helped me the most when I first started at Network to Code was finding another new hire who felt similarly and sharing how we felt in a way that helped us both relate to each other.
  3. Distinguishing humility and fear is important. We can be humble and accept success without the fear of being a fraud that tends to come with it. Remember, fear is a feeling, and feelings are not facts.
  4. Letting go of perfectionism is definitely one of the hardest things for me to do, however just understanding that perfectionism is unhealthy and perfection is unattainable is itself a great start.
  5. Being kind to myself is completely opposite to the way my impostor self normally thinks but is also just as important of a step in quieting the impostor voice.
  6. Tracking your successes really helps you fight impostor syndrome, as it gives you a physical, tangible list of hard accomplishments that you have earned and achieved.Dr. Hibberd does a great job describing this in her book as gathering evidence for a trial, where you are the defendant and the impostor syndrome is the prosecution. It will come up with every negative thing it can think of as evidence for why you are an impostor. It is important for you to have your own physical “proof” to counter its claims and show that you really have accomplished things and earned your current level of success. We don’t want to keep these accomplishments just in our head. Simply the act of writing them down can psychologically trick our brains into making them more real, which is exactly what we want: to recognize them as real.
  7. Talking with your mentor or a manager is a great way to open up to someone you trust who is in a position to help you. I would be very surprised if they didn’t respond empathically and with similar stories from their past.
  8. Saying yes to opportunities, even when you don’t feel like you deserve them or are able to accomplish them, is hard at first, and you may even need to force yourself to do it. But know that it is the impostor that is holding you back, not your actual capabilities.
  9. Lastly, embracing the feeling for what it is, and accepting the fact that you feel it, is so critical. Your feeling is valid. It is normal. It is real. However, it does not mean it is a fact, and you have the right and responsibility to yourself to question negative feelings. It doesn’t mean they are always wrong either, but it does mean that upon closer inspection they may not be as real as they feel.

Criticism vs. Compassion

A strategy Dr. Hibberd discusses in her book is to learn criticism vs. compassion and to learn to recognize what the impostor voice sounds like in our own head. We must become aware of when it is the impostor voice inside of our head speaking vs. our regular self. The more I learn about what impostor syndrome sounds like, the easier it is for me to identify it.

For example, what words and tone am I saying to myself? Is it negative or positive? If it is negative, is it actually helping me at all? Lastly, is this something I would say to someone else’s face?

Once I am aware of when the impostor voice is speaking, I can work to silence it and find a new voice for myself. I replace the negative words with positive words I would normally say to someone else. I accept and acknowledge both my successes AND my mistakes, and acknowledge that mistakes are COMPLETELY NORMAL. Everyone makes mistakes—literally everyone. Therefore, it would be abnormal to go through life without ever making a mistake. We all know that just doesn’t happen!

I recognize now that I cannot be perfect (perfectionism), and I will make mistakes. But I also recognize that I do the best that I can, with the resources provided to me, at any given point in my life. For my entire IT career I can say this is true, so I now offer myself compassion instead of criticism whenever I make a mistake, no matter how big or small.

IT-Specific Strategies

I really struggle in IT whenever I start a new job, especially this one here at Network to Code where everyone is incredibly smart and talented in the field of network automation. For me, the first three to six months at a new job are a real struggle, but I’ve come up with some tips that have helped me and hopefully help you as well.

  1. Find an “easy-win” ticket or open issue to tackle. We work out of GitHub, and there are many projects where there are numerous issues with the label “good first issue”. These are very real issues that we may need to solve, however they may be minor yet time-consuming enough that other employees are already engrossed in projects and deadlines and may not have the time to work on them.Project issues with this label are really good for people new to the project to enable them to contribute, while also learning a lot about the project itself and how it works at a technical level.
  2. Documentation. Everyone loves it. Nobody wants to take the time to work on it. It’s one of those truisms of IT that seems to exist literally everywhere. However, working on documentation forces you to understand and learn about a topic in order to explain it well. Additionally, everyone loves updated documentation and appreciates documentation work. Most of the times I’ve worked on documentation for someone else’s project, I’ve gotten a DM from them personally thanking me for the effort.In doing this, you’ll have not only accomplished something, you will most likely have learned something, and you will have felt a sense of satisfaction from it. Doing this will help you integrate into your new role or project and help you feel more comfortable as you settle in.
  3. Ask questions. There have been so many times I have wanted to ask a question in a public Slack channel, and I’ve been too afraid to do so for fear of others perceiving me as incompetent. Granted, there are some times I have a “case of the Mondays” and ask questions I don’t really need to, but then again who hasn’t? I’ve learned to simply shrug those times off, and it gives me something good to laugh about later.

For the most part, the questions I ask actually help others who may reference them later without me ever knowing that they did. I know this because I do exactly this all the time!


I once asked “How do I delete device results in the Golden Config plugin?” in our internal Slack channel. One very smart and respected manager responded with “Just click the delete button.” As embarrassing as that was, I accepted that I was having a rough day that day, I acknowledged it in the channel by making a joke about it, and I moved on.


Instead of thinking “Everyone must think I’m an idiot” (criticism), I instead thought to myself “I must be starting to wear down mentally from troubleshooting a bug in my project all day. Now is a good time to take a break” (compassion and self-care).

Final Thoughts

I genuinely hope my sharing some of my experiences and what I’ve learned can help others with similar struggles. Impostor Syndrome in IT is a very real thing that is so rarely talked about. But only through talking about it, and not being afraid to talk about it, can we overcome it.

I mentioned this earlier, but if you feel comfortable doing so, I encourage you to leave a comment below or reach out to me directly. I can be reached by my handle @mattv on Network to Code’s public Slack org, or by email at matt.vitale@networktocode.com.

I’ll leave you with one final quote I found on Twitter by Jen Heemstra that I really liked.

Thanks for reading.

-Matt

Additional Resources

Here are some additional resources I’ve found helpful, and they have helped inspire this blog post.

The Imposter Cure – Book

How Do You Overcome Imposter Syndrome? – Blog

9 Ways to Deal With Imposter Syndrome Before It Hinders Your Success – Blog



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!

Setting Up Nautobot ChatOps with Microsoft Teams – Fall 2022

Blog Detail

NOTE: This blog post is an updated copy of previous ones from April 2021November 2021, and March 2022. It has been updated with the latest process changes within Microsoft Azure and Teams due to certain original processes being deprecated or modified significantly over time, both on the Microsoft Azure side as well as the Microsoft Teams side.

Network to Code has released a number of amazing apps for Nautobot—one of which, adding ChatOps functionality, can be found here on GitHub. This application adds ChatOps capabilities directly into your existing ChatOps client, in the form of a chatbot, and supports four of the more popular services available right now. The four services currently supported are Slack, Microsoft Teams, Webex, and Mattermost.

If this is your first time hearing about ChatOps or this app (plugin), you can watch the ChatOps demo on YouTube or join slack.networktocode.com and try it out for yourself in the #nautobot-chat channel.

Today, I’ll be going over how to get this app working in Nautobot and how to get a chatbot up and running for Microsoft Teams. The process is fairly different from the other three providers listed, and slightly more complex, but the end results are amazing. Let’s dive right in!

Getting Started

With any ChatOps service, getting the ChatOps plugin working has two main parts: configuring it on the ChatOps service directly, and installing and configuring it on your Nautobot server. Microsoft Teams splits the first part into two sections: creating the service in Azure, and installing the app in the Teams client.

For simplicity, I will assume you already have the base Nautobot server installed and working. If not, you can find the full documentation over on our new Nautobot Documentation site, or join our public Slack channel #nautobot at slack.networktocode.com and ask for assistance.

Part 1: Configuring Microsoft Teams SaaS

Azure and Permissions

To start off, I will be configuring a brand-new bot for Microsoft Teams from scratch. Microsoft runs their bots differently from Slack, Webex, or Mattermost, in that their bot service runs on Azure. If you don’t have a Microsoft Azure account, you will need to create one or get access to it through your company before continuing.

According to the Microsoft docs, you will need “Contributor access either in the subscription or in a specific resource group. A user with the Contributor role in a resource group can create a new bot in that specific resource group. A user in the Contributor role for a subscription can create a bot in a new or existing resource group.”

Configuring Azure

The three main parts to configuring a bot in Azure:

  1. Create an Azure Bot Service and Resource Group
  2. Configure the Azure Bot Channel
  3. Create a Client Secret for the Azure Bot

I’ll break down each part individually, with step-by-step instructions and screenshots along the way.

1 – Create an Azure Bot and Resource Group

First, log into the Azure Portal at https://portal.azure.com.

At the top of the screen is a search bar. Search for “Azure Bot”, then select the option with the same name under “Marketplace” on the right side. This will take you to the page to create a new Azure Bot.

NOTE: You may need to activate this service first within your company’s Azure subscription, which is not covered in this post.

A few key fields to fill out when creating a new Azure Bot are:

  • Bot Handle – What you want your bot handle to be. This is not what your bot is called in the MS Teams client, or how users will interact with your bot, but it is unique (case-insensitive) within the overall Azure Bot Framework.
  • Subscription – The Azure billing subscription your bot will use for any charges.
  • Resource Group – If there’s an existing one you want to use, select it. Otherwise, select the “Create new” link and create a new resource group. In this example, I’m creating a new Resource Group called “RG_nautobot_ntcblog”.
  • New Resource Group Location – Choose whichever location works best for you.
  • Data Residency – If this preview option is present, leave it set as “Global”.
  • Pricing Tier – This defaults to “Standard”, which will incur costs. For demo/development purposes, I changed this to the “Free” tier.
  • Type of App – For the purposes of this blog post, selecting “Multi Tenant” works best here to allow the Bot access to different resources.

For Creation Type, leave the default option selected: Create a new Microsoft App ID and click the Review + create button at the bottom.

Note: Tags are optional, but feel free to experiment with them later.

After Azure validates your settings, the Create button will be enabled. Click it to initiate the deployment process in Azure. This may take a few minutes, but it will let you know once the deployment is complete.

Once complete, go to the newly created resource by selecting the Go to resource button. You can also monitor its progress in the upper right of the Azure dashboard, under the alerts icon (looks like a bell).

2 – Configure the Azure Bot Channel

On the main resource page for the new Azure Bot, on the left main bar, select Channels under the Settings section. Then select the Microsoft Teams client icon, as circled in the screenshot below.

A small window may pop up asking you to accept the Terms of Service. If so, review and select “Agree” to continue.

All of the options on the next Configure Microsoft Teams page should be okay when left to default, but should be reviewed anyway for your specific use case.

Once done, click Save at the bottom of the page, and review and Agree to any ToS pop-ups.

3 – Configure the Messaging Endpoint

Next, on the left sidebar, select Configuration under the Settings section.

For the Messaging Endpoint, enter your Nautobot service URL in this format: https://<server>/api/plugins/chatops/ms_teams/messages/.

In this demo example, I’m using the Ngrok service. For a production Nautobot server, you would enter in the publicly facing DNS endpoint for inbound webhooks into your Nautobot server.

Also take note of the read-only Microsoft App ID listed on your screen. This will be needed later on in the setup process.

Click Apply to save the changes.

4 – Create a Client Secret for the Azure Bot

On this same Configuration page, select the “Manage” link directly above the App ID.

This will take you to the Certificates & Secrets page.

Click New client secret. Name it something descriptive, configure the expiration setting as necessary, and click Add.

Once it’s created, it will appear in the Client Secrets table at the bottom of the page. Copy and save the newly generated secret for later, as there’s no way to recover it once you leave the page.

NOTE: If you lose the key or copy it incorrectly, you will have to return to this page and generate a new secret.

Azure Recap

At this point, the Nautobot ChatOps plugin is fully set up within Azure. You should have two pieces of information for later use: the App ID and the Client Secret.

Part 2: Installing and Configuring the Nautobot ChatOps App (Plugin)

Note: The terms plugin and app are being used interchangeably in this post.

Next, you must install and configure the Nautobot ChatOps plugin on your Nautobot server. Luckily, the fine folks at Network to Code have made this process incredibly simple!

Installing the Plugin

First, log into your Nautobot server and change to the user account Nautobot is running as. From there, it’s as simple as installing the plugin via a pip install command.

$ sudo -iu nautobot
$ pip3 install nautobot-chatops

Once the package is installed, the plugin will need to be enabled in your nautobot_config.py. If Nautobot was originally set up according to the default installation docs, this file will be located at /opt/nautobot/nautobot_config.py. In this file, add in the name of the plugins to the PLUGINS variable, then configure the required settings in the PLUGINS_CONFIG variable below it.

<span role="button" tabindex="0" data-code="PLUGINS = ["nautobot_chatops"] PLUGINS_CONFIG = { "nautobot_chatops": { "enable_ms_teams": True, "microsoft_app_id": "<app_id>", "microsoft_app_password": "
PLUGINS = ["nautobot_chatops"]

PLUGINS_CONFIG = {
    "nautobot_chatops": {
        "enable_ms_teams": True,
        "microsoft_app_id": "<app_id>",
        "microsoft_app_password": "<client_secret>"
    }
}

Make sure to replace <app_id> and <client_secret> with the App ID and Client Secret saved from Azure in the previous steps. Then save the file and restart the NGINX and Nautobot services.

sudo systemctl restart nginx
sudo systemctl restart nautobot-worker.service

Configuring the Plugin in Nautobot

Next, we need to configure the plugin in Nautobot to accept commands. For most deployments, open and unrestricted access to the bot from any chat account is undesirable. Therefore, access to the chatbot defaults to “deny all” when initially installed. Permissions for individual organizations, channels, and users must be set up here. For the purposes of this blog post, we will grant all access.

First, log into your Nautobot server. If this is the first plugin installed, a new menu option called Plugins will appear at the top. Under it, in section Nautobot ChatOps, select Access Grants.

Select the Add button to create a new access grant.

  • Command – You can specify permissions on a command-by-command basis, or specify all commands with an asterisk * as a wildcard. Example commands: nautobot or clear
  • Subcommand – You can specify permissions for subcommands as well, or all subcommands with an asterisk *. Example subcommands: get-devices or help
  • Grant Type – You need to create permissions for all three options: Organization, Channel, and User.
    • Organization – This is for permissions specific to your organization. This is good for configuring allowed/blocked commands organization-wide.
    • Channel – This is for configuring permissions on a per-channel basis.
    • User – This is for configuring permissions on a per-user basis.
  • Name – The corresponding name of the organization, channel, or user. This is used more like a description, whereas the value below is used when interacting with the MS Teams SaaS API on the back end.
  • Value – Corresponding ID value to grant access to. Enter an asterisk * to grant access to all organizations, channels, or users.

Once all three permissions are created, the plugin is done being set up in Nautobot. The minimum amount of permissions required are three. You can allow everyone in your organization access to all commands (not recommended) by using wildcards for organization, channel, and user permissions.

In the above example, here’s how I’ve set it up:

  • Organization – The org has access only to the nautobot command. It does not have access to clear, or any future commands the plugin may end up supporting.
  • User – Anyone can run just the nautobot get-devices command, however user John Doe can run any command. Note that he cannot run clear, as that is restricted at the Organization permission above.
  • Channel – Anyone can access the bot from any channel, but again, only the nautobot get-devices command. However, anyone in channel bot-admins can access any command available to them.

To summarize, anyone can run nautobot get-devices, whereas John Doe and anyone in the channel Bot Admins can run any nautobot subcommand. Nobody can run clear or any command that doesn’t start with nautobot.

The last step is configuring the Microsoft Teams client.

Part 3: Installing and Configuring the App in Teams

The last main step needed is uploading and installing the app into your Microsoft Teams web portal for use within your organization.

Before continuing, you need to download a single ZIP file from the ChatOps plugin repo, found here. This will be used later for ease of configuring your app for your organization.

The ZIP file contains three files:

  1. manifest.json – Preconfigured information for the bot
  2. color.png – Icon to use for the bot
  3. outline.png – Transparent image to use for the bot

First, log into the Microsoft Developer Portal. Select Apps from the left menu bar, then Import App at the top of the screen. Select the Nautobot_ms_teams.zip file you downloaded earlier to import.

Note: You may get the below import error. This can be safely ignored, as we want the root ID it references to be auto-generated _after import. Click the blue Import button to ignore this error and complete the import._

Once imported, the Edit an app page will appear, allowing you to configure the settings for the bot.

Required Setting Changes

There are two settings that must be modified for the Azure Bot Application ID. This is the same App ID that was copied out of Azure earlier in the setup process.

First, scroll to the bottom of the Basic Information page under the Configure section. In the field Application (client) ID, paste in the application ID you copied out earlier from Azure. Then click Save at the bottom.

Next, click on App Features under the same Configure section. Near the top will be one or more tiles. Select the ... for Bot, then select Edit.

On the next screen, under Identify your bot, select the existing Bot ID from the drop-down list. If it doesn’t show up (as in the below screenshot), you can select Enter a bot ID and copy in the Bot ID from Azure manually. Then click Save.

All other settings are preconfigured as necessary, but you are welcome to adjust them as needed.

Submit Bot App for Organizational Use

Once you are ready, under the Publish section select Publish to org and select the blue Publish your app button.

It will then be submitted for approval by your MS Teams administrators.

Once approved, the status will change from Submitted to Published, and you can find the app in your MS Teams client. However, we still need to activate it first.

Note: I had to wait approximately 30 minutes and restart my client before the app appeared in this section. If it doesn’t show up right away, you may have to wait up to a few hours.

Open your MS Teams client and select Apps at the bottom of the left-side menu. Select “Built for your org” to see the new Nautobot app. Select the new app and click the blue Add button.

Done

That’s it! Your new Nautobot ChatOps plugin should now be installed for your Microsoft Teams client and usable by anyone with the appropriate permissions (configured earlier in part 2).

You can do some really cool things with the bot once it’s up and running and you have some data in Nautobot. You can send the message nautobot help to the app (no / forward slash) to see a list of all supported commands.

Interacting with Nautobot in Microsoft Teams

There are currently a couple of ways to interact with the Nautobot plugin by default directly in the Microsoft Teams client, although these can be modified in the app permissions in the same area where you installed the app originally (in part 3). They are:

  1. Chat – In the main left sidebar, select Chat, then search for “Nautobot” (or whatever you renamed the bot to). You can message the bot directly here.
  2. App – In the main left sidebar, select the three dots, then in the pop-out menu, search for “Nautobot” and select it. I recommend right-clicking the icon in the left sidebar once the window opens to pin it for future interactions.

Forward Looking

Here at Network to Code, as we continue developing Nautobot, we will be adding functionality to this ChatOps plugin as well. With the code publicly available here on GitHub, we encourage anyone looking to contribute to do so and join our growing open-source community around Nautobot!


Conclusion

Additionally, there’s a blog post from a few months ago around creating your own custom chat commands within this plugin. If interested, you can read it here.

Thanks for reading, and I hope you enjoy ChatOps as much as I do!

-Matt



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!