Since Azure is being updated rather often, I have yet to find an updated guide on how to do remote Azure debugging specifically for Visual Studio 2017.
I would simply like to know how to attach to the process running on the Azure server so that I can debug my web app.
In Solution Explorer, right-click the web project (not the WebJob project), and click Publish. In the Profile drop-down list, select the same profile that you used in Get Started with the Azure WebJobs SDK. Click the Settings tab, and change Configuration to Debug, and then click Publish.
You can attach the Visual Studio debugger to a running process on a local or remote computer. After the process is running, select Debug > Attach to Process or press Ctrl+Alt+p in Visual Studio, and use the Attach to Process dialog to attach the debugger to the process.
Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
If you are talking about debugging a web site or api hosted in app service or service fabric, you should try using Cloud Explorer. My experiences with it have been very good.
Its pretty simple. When you open up Cloud Explorer, it shows all subscriptions and resources available to your account(s). When opening e.g. the app services for your subscription, you deployed application will be visible. You can then simply right click and say "attach debugger", as can be seen here:
You can add multiple accounts to visual studio, and select the one that has access to the resource.
This is a more extensive tutorial on how to use the Cloud Explorer:
https://docs.microsoft.com/en-us/azure/vs-azure-tools-resources-managing-with-cloud-explorer
There were different ways of doing this, but I think a few of them are outdated. Anyways, this is what worked for me:
Turn on Remote Debugging under Azure Portal -> Your web app -> Application Settings
Attach to the process in Visual Studio 2017 -> Debug -> Attach to Process.. -> Input YourWebAppName.azurewebsites.net:4020 and hit ENTER
It'll ask for credentials. My AD credentials did not work here, which brings us to step 4..
Azure Portal -> Overview -> Get publish profile. It'll download the publish profile for your web site. In that file, you'll find msdeploySite, userName and userPWD. Use them for step 2.
You should now be able to see the w3wp process and attach your debugger to it.
These answers/sites helped me find the solution:
https://blogs.msdn.microsoft.com/benjaminperkins/2017/01/09/cannot-publish-to-soveriegn-cloud/
https://blogs.msdn.microsoft.com/benjaminperkins/2017/06/06/remote-debug-your-azure-app-service-2017-including-asp-net-core/
https://stackoverflow.com/a/35738995/2504659
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With