Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article describes how to add code scan insights using GitHub Copilot Modernization when migrating web apps to Azure Kubernetes Service (AKS) or Azure App Service. Adding code insights helps you better assess migration readiness and get recommendations for migration strategies based on the code changes identified during the scan. Code changes for an application are the aggregate of code changes for its child web apps.
In this article, you learn how to:
- Generate GitHub Copilot code assessment report for web apps.
- Add code insights for Web apps from Applications inventory and assessment page
- Add code insights for Web apps from Web apps inventory and assessment page
- View code insights
You can add code insights to web app assessment using either of the following two methods:
- Upload using ZIP file - Use this method when you already have a code scan report or have permissions to generate one.
- Request report through GitHub issue - Use this method when you cannot generate code insights report yourself or do not have access to code repository. This approach allows Cloud administrators and Application developers to collaborate while adhering to their organization’s code security guidelines.
Manually upload code scan reports using a ZIP File
With this approach, you must generate the code scan report manually and upload it as a ZIP file.
Prerequisites
- Web apps for which code scan report is to be generated.
- GitHub Copilot code assessment report for selected web apps.
Generate GitHub Copilot code assessment report
You can generate code assessment report using GitHub Copilot app Modernization extension or AppCAT CLI.
GitHub Copilot App Modernization extension
- Install GitHub Copilot app modernization extension in Visual Studio Code.
- Open the source code of your Web app from GitHub repository. You must have permissions to the code repository.
- On the sidebar, select the GitHub Copilot app modernization pane, where you can select Migrate to Azure or Run Assessment in the ASSESSMENT section.
- Upon completion of assessment, you can download report.json file at the location of your choice.
- Create a ZIP file for all the reports you want to add.
AppCAT CLI
- Install AppCAT:
- For .NET use the command:
dotnet tool install --global Microsoft.AppCAT.ToolFor detailed instructions, see Install the .NET global tool. - For guidance on assessing Java projects, see Assess a Java project using AppCAT 7.
- For .NET use the command:
- Generate AppCAT Reports
- After installing AppCAT, generate reports for all assessed web apps: For .NET applications, use the .NET CLI to analyze applications. For more details, see Analyze applications with the .NET CLI.
- For Java applications: To run AppCAT against a sample Java project, see Run AppCAT against a sample Java project.
- Create a ZIP file for all the reports you want to add.
Upload a ZIP file
1.You can add code assessment report from any of the following: - On the Azure Migrate Overview page, under Explore inventory, select Web apps. - On the Azure Migrate Overview page, under Explore Applications, select Applications. - On the Azure Migrate Overview page, under Decide and Plan, select Assessments. Choose the Application assessment or Web app assessment. 2. In Add code insights dropdown, select GitHub Copilot assessment.
- In the Add Code Insights page, select Upload a ZIP file.
- Select Browse. Select the location of the ZIP file that contains the reports to import, and then select Upload. Wait for the upload and validation to complete.
- In the Web app list, under the GitHub Copilot assessment report dropdown, view the uploaded reports under Uploaded from ZIP file.
- Select the appropriate report to map to the corresponding web app. Repeat these steps for all required web app.
- After mapping, select Add and wait for the process to complete.
- After mapping is complete, Code changes column in Applications and Web apps pages shows Available. All assessments for the selected web apps or application are marked as outdated. Select Recalculate to initiate recalculation.
- Select Available on the Applications or Web apps page to view code insights. If code changes are included, the number of changes for the recommended Azure target are displayed.
Request report via GitHub
This method connects Azure Migrate to a GitHub repository using the provided connection details and automatically creates an issue in that repository. By using the GitHub Copilot app modernization extension, you can scan your code and upload reports directly to the related GitHub issue. After updating the issue, Azure Migrate automatically attaches the code scan reports to the associated web applications. This approach allows Cloud administrators and developers to collaborate while maintaining application code security boundaries.
Prerequisites
- Ensure a web app assessment exists for each web app because code scan reports can only be added to an existing assessment.
- Provide information about the GitHub repository required for integration with Azure Migrate to allow automatic requests and synchronization of code scan reports.
- Provide GitHub application details with permissions to create issues and read comments in the target repository.
Create new GitHub app
Create a new GitHub App by following these steps:
- In the top right corner of GitHub page, select your profile picture.
- Navigate to your account settings.
- For an app owned by a personal account, select Settings.
- Select Your organization and then Settings from right of the organization.
- For an app owned by an enterprise:
- If you use Enterprise Managed Users, select Your enterprise to go directly to the enterprise account settings.
- If you use personal accounts, select Your enterprises then select to Settings from the right of the enterprise.
- For an app owned by a personal account, select Settings.
- Navigate to the GitHub App settings.
- For an app owned by a personal account or organization:
- In the left sidebar, select Developer settings, and then select GitHub Apps.
- For an app owned by an enterprise
- In the left sidebar, under Settings, select GitHub Apps, and then select New GitHub App.
- For an app owned by a personal account or organization:
- Provide the following details to set up your new GitHub App:
- Under GitHub App name, enter a name for your app.
- Under Homepage URL, provide the complete URL. This URL serves as a placeholder and isn't used in this process.
- Ensure that Expire user authorization tokens is selected.
- Deselect Active under Webhook
- Under Permissions, select Repository permissions and then select the following permissions for the app.
| Resource | Permissions |
|---|---|
| Issues | Read and write |
| Metadata | Read-only |
| Webhook | Read and write |
- Under Where can this GitHub App be installed?, select Only on this account or Any account.
- Select Create GitHub App.
Install GitHub app on the repository
Follow these steps to install GitHub App on your repository:
- Navigate to the GitHub App you created.
- Select Install App
- Select an account to install the app, and then select Install. Use the account that contains the repository for creating issues and uploading code scan reports.
Select Only select repositories, then select the appropriate repositories from Select repositories. You can select multiple repositories. When finished, select Install.
After the installation completes, note the browser URL that contains the installation ID. For example:
https://github.com/settings/installations/<installationID>
GitHub App details and Private key to create GitHub connection
Collate the following GitHub App details and private key and create a GitHub connection in Azure Migrate.
- Navigate to the GitHub App you created and select Edit.
- Under General > About, find the App ID and note it.
- Scroll down to Private keys and select Generate a private key.
Note
Rotate the private key every 90 days for security. If you generate a new private key, you must recreate the connection because updating the key isn’t currently supported.
- The new private key file downloads automatically to your machine.
- To find the Installation ID, navigate to Install App and select Settings next to the account where the app is installed.
- After the installation completes, note the browser URL that contains the installation ID. For example,
https://github.com/settings/installations/<installationID>
Request code scan report for web app and application assessment using GitHub issue
- You can add code assessment report from any of the following:
- On the Azure Migrate Overview page under Explore inventory, select Web apps.
- On the Azure Migrate Overview page under Explore Applications, select Applications.
- On the Azure Migrate Overview page under Decide and Plan, select Assessments. Choose the Application assessment or Web app assessment.
- Under Add code insights, select Using GitHub Copilot Assessment.
- In the Add code insights page, select Create GitHub connection.
- In the Create new GitHub connection page, provide the following details:
| Field | Details |
|---|---|
| Connection name | Provide a name for the connection. This name appears in the list when you add report to the web app. |
| GitHub repository URL | Specify the GitHub repository for creating an issue to request a code scan report. Upload the code scan report to this issue using GitHub Copilot. Use this repository only to create GitHub issues and read code scan reports from those issues. You don't need to include application code in this repository. |
| App ID | Enter the App ID of the GitHub App you created to allow Azure Migrate access. |
| Private Key | Copy all the contents of the private key file you generated for your GitHub App. |
| Installation ID | Enter the Installation ID of the GitHub App installed on the repository you specified above. |
- After you add the details, select Create connection. Wait until the connection is successfully created and then select Close.
- On the Add code insight page in the web app, from the list, select Request report via GitHub.
- In the Request report via GitHub page, select the appropriate connection name and then select Request.
- Azure Migrate creates GitHub issue in the repository specified in the connection details.
- When the code scan report is uploaded to the GitHub issue, Azure Migrate automatically maps the report to the web app and corresponding Applications.
- After mapping is complete, Code changes column in Applications and Web apps pages shows Available. All assessments for the selected web apps or application are marked as outdated. Select Recalculate to initiate recalculation.
- Select Available on the Applications or Web apps page to view code insights. If code changes are included, the number of changes for the recommended Azure target are displayed.
Generate code scan report using GitHub Copilot app modernization extension
To generate report, follow the steps:
- To generate report for .NET follow these steps Assess and migrate a .NET project with GitHub Copilot app modernization for .NET.
- To generate code scan report for Java, follow these steps Assess a Java project using GitHub Copilot app modernization.
- Once the report is available, upload the report to GitHub issue using below prompt in GitHub Copilot.
- upload assessment report to [GitHub Issue URL]
View code insights after adding code scan reports
- Select Assessments on the Azure Migrate project Overview page under Decide and Plan.
- Search for the assessment with the Workloads filter and select it.
- On the assessment Overview page, select the Recommended path tab or View details in the recommended path report.
This screen displays the distribution of web apps across Azure targets. Select a line item to drill down further. - This screen displays the distribution of the web apps across the Azure targets. Select a line item to drill down further.
- Select View code changes under Code insights. Review the code changes by selecting the relevant tab: Issues, Warnings, or Information. These tabs provide a summarized view of code changes across the web apps in the assessment.
- Select the number in the Code changes column for the respective web app to view its changes.
After you add code scan reports, the readiness and migration strategy for the relevant web app might change based on the identified code changes. If the required code changes required are significant, the webapp's readiness might update from Ready to Ready with conditions.
Troubleshooting
This section helps resolve issues related to importing paths or uploading ZIP files that don’t meet the required constraints.
Upload using Zip file
- When failed to upload reports as ZIP file: Follow these guidelines to successfully import paths and upload ZIP files without errors.
Unable only Zip files that meet these requirements:
- Contains only JSON files.
- Zip file is less than 50 MB.
- Total number of files in ZIP file is less than 100.
- Maximum size of uncompressed ZIP file is less than 500 MB.
- Zip file doesn't contain another nested ZIP files.
You might see errors if the uploaded ZIP file doesn’t meet the required constraints. Here are some examples:
- The uploaded blob content type '%Value;' isn't supported. - Occurs when the uploaded file is not a ZIP file.
- Zip contains too many files (%FileCount;). Limit is %MaxFileCount;. - Occurs when the ZIP file contains more than 100 files.
- Total uncompressed size %UncompressedSize; MB of uploaded ZIP file exceeds limit of %MaxUncompressedSize;MB. - Occurs when the uncompressed size of the ZIP file exceeds 500 MB.
- Zip entry '%EntryName;' is invalid (possible path traversal). - Occurs when a file name in the ZIP contains path traversal characters such as ../../.
- The uploaded ZIP file is empty and contains no valid files. - Occurs when the ZIP file does not contain any files.
If you see any of these errors, remove the invalid or extra files and recreate the ZIP file before uploading it again.
- Partial files or No files accepted for report generation: Even if the ZIP file meets all guidelines and is processed, you might not see the reports for every file in the ZIP. This can happen due to issues such as JSON schema incompatibility or unsupported targets in the report file. When this occurs, Azure Migrate uses content from valid files to generate the report. Files that fail validation return errors like:
- The report content is invalid or not in the expected JSON format. - Occurs when the JSON report schema is invalid or incompatible.
- The report doesn't contain supported targets for the specified framework. - Occurs when the report includes targets that Azure Migrate doesn't support. AppCAT supports many targets, but Azure Migrate only supports a subset.
When you encounter these errors, regenerate the report with the correct configuration and upload it again using a separate import flow.
Next steps
Learn more about create a web app assessment.