Microsoft Security Copilot 3 min de leitura

Set up an initial Copilot for Security investigation session

Este artigo ainda não foi traduzido — está a ver a versão em inglês.

Nesta página
  1. Fork the repository
  2. Clone the fork to your local machine
  3. Set the upstream remote
  4. Create a new branch
  5. Make your changes
  6. Push your changes and create a pull request
  7. Sync your local repository after merge

The Microsoft Copilot for Security community repository is a place where users can contribute plugins and other resources to help the wider security community. If you have developed a KQL plugin or a workflow that you believe would be useful to others, the process involves forking the repository, making your changes in a local branch, and submitting a pull request for review.

This guide walks you through the technical steps to contribute code to the Azure/Copilot-For-Security repository. It assumes you have a GitHub account and are familiar with basic Git operations.

Fork the repository

The first step is to create your own copy of the repository. This allows you to make changes without affecting the main community repository.

  1. Navigate to the Copilot for Security community page on GitHub.
  2. Ensure you are on the master branch.
  3. Click the Fork button and select Create a new fork.

This creates a copy of the repository under your own GitHub account. You will now have your own Copilot-For-Security repository that you can modify freely.

Clone the fork to your local machine

Next, you need to clone your fork to your local development environment. You can use Git Bash, GitHub Desktop, or any Git client.

  1. Create a directory on your local machine where you will work. For example, C:\Users\(username)\Documents\GitForks.
  2. Open your terminal or Git Bash and navigate to that directory.
  3. Run the following commands:
git init
git clone https://github.com/(username)/Copilot-For-Security-Fork.git
cd Copilot-For-Security-Fork

Replace (username) with your GitHub username. This clones your fork into a local directory.

Set the upstream remote

To keep your fork in sync with the original community repository, you need to add the original repository as an upstream remote. This allows you to pull updates from the main repository into your fork.

Run the following command:

git remote add upstream https://github.com/Azure/Copilot-For-Security

Verify that the remotes are set correctly by running:

git remote -v

You should see two remotes: origin pointing to your fork, and upstream pointing to the Azure community repository.

Create a new branch

It is best practice to work on a separate branch for each contribution. This keeps your changes isolated and makes it easier to manage multiple contributions.

  1. First, sync your local repository with the upstream main branch to ensure you have the latest changes:
git pull upstream main
  1. Create a new branch for your contribution. Use a descriptive name for the branch.
git checkout -b my-kql-plugin

Make your changes

Now you can create and edit your files. For example, if you are contributing a KQL plugin, you might create a new folder under Community Based Plugins and add a .yml file.

  1. Open your local repository in Visual Studio Code or your preferred editor.
  2. Create the necessary files and directories.
  3. Stage your changes by clicking the Source Control icon in VS Code, entering a commit message, and clicking the + to stage them.
  4. Commit the changes by clicking the checkmark.

Push your changes and create a pull request

Once you are happy with your changes, you need to push them to your fork on GitHub and then create a pull request to the main repository.

  1. Push your branch to your fork:
git push origin my-kql-plugin
  1. Go to your fork on GitHub. You should see a prompt to Compare & pull request for your new branch.
  2. Click Compare & pull request.
  3. In the pull request description, provide a clear summary of your changes and what the plugin does. This helps reviewers understand your contribution.
  4. Click Create pull request.

The pull request will trigger automated checks. If these pass, it will be reviewed by the community maintainers. Once approved, your changes will be merged into the main repository.

Sync your local repository after merge

After your pull request is merged, you should update your local repository to reflect the changes.

  1. Pull the latest changes from the upstream repository:
git pull upstream main
  1. Verify that your changes are now in your local main branch.

This ensures that your local repository is up to date with the community repository.

Reference: README.

Pesquisar