download azure diagnostic logs? - azure

Does anyone know how to download the Azure diagnostic logs? From the control panel, it shows me an ftp link for the logs, but when I click it it prompts me for a username/password. Any username/password I try just results in a "530 User Cannot Login" error.
It looks like the same address that Vis Studio does it's publishing to, and that had a '$' before my username. I tried that as well, but no-go.
Just curious how to get the logs when you start having errors pop up in the application, or is there something else I should be doing to prepare my app for going on Azure?
Thanks,
Mike

You would need to use FTP client application to access to files instead of using the Webpage as it is designed to use a client app to display the files.
I have configured FileZilla as below to access my Windows Azure websites to access Diagnostics Logs as well as use the same client application to upload/download site specific files:
In my blog Windows Azure Website: Uploading/Downloading files over FTP and collecting Diagnostics logs, I have described all the steps.

As an update as of December 2015 (New Azure Portal)
Apparently the FTP Username and Password is not set by your publish settings or anything else that I can find.
The steps to first set up your FTP credentials are to go to your web app on the new portal. Click the settings icon at the top of the "blade". There's like 25-30 different links to settings there. The one we want is under Publishing and then Deployment Credentials.
I thought I had already set these up with my publish profile but those were not working. You should have the opportunity to enter your desired username and password now for FTP and git specifically.
Now go to the blade for Diagnostics (It was right above the publishing section) and you can copy the ftp url. I just copied the first one (ftp not ftps), went to FileZilla and used the ftp url, my new username and password, and port 21 and I was able to see all log files as expected.
This does NOT mess up or affect your publishing credentials in any way that I can see.

On the new Azure Portal there's a new concept of site extensions there you can find an extension called Azure Website Log Browser which makes it extremly easy for you to access your website's logs (viewing and downloading them).
You can read more about it here.

Just to clarify the process, for me it was:
Setup APP server properly (Deployment -> Deployment Credentials ... set username and password
Read correct username at Monitoring -> Diagnostic Logs ... there's a label with SERVERNAME\USERNAME (this whole is username!)
Use WinSCP for SFTP connection and configure it properly. Then I was able to connect.

I had the same problem but your image helped solve my problem. I wasn't using the [sitename][username] (I say sitename but perhaps I should call it hostname/domain)
I don't know if this will help you, and you may have already tried it, but the username I used was my Windows Live ID. (I did not use the dollar $ign)
Oh and one other thing and I don't know if this matters or not as far as accessing the ftp site where logs are stored but make sure you have enabled them under Websites | [select your website] | Configure - Then scroll down to Diagnostics and click "ON" for the logs you want turned on.
I added that last part because I don't know if your ftp.[sitename].azurewebsites.windows.net/LogFiles/ directory has been created and since this is where I am dropped off at (/LogFiles) after signing in, if it doesn't exist you might not be able to log on.. just an after thought.
Good luck!
John

Make sure that you set up deployment credentials for the application. This is needed by FTP. (Example user name: MyFtpUserName)
Then, when browsing to that provided ftp link, remember to qualify the user id with the domain. (Example qualified user name: MyWebSiteName\MyFtpUserName)

Related

Where i can find ftp credentials for azure web app linux?

I would access the content of my linux app on azure using ftp but i dont know where find the ftp credentials.
In the deployment center i cannot find any ftp section, instead i get some informations on git distribution.
Somebody can help me?
It's likely that you previously set Git deployment for this Web App and this is why the UI defaults to Git. If you don't need it anymore, simply click on Disconnect. This way you can select and set FTP deployments again in Deployment Center.
You can also get the FTP URL from the Overview tab but what about the FTP credentials? Simply click on the Get Publish Profile link, they are in the XML file that will be downloaded.

How to debug 'Login failed for user' on an Azure SQL database?

Here's the error message that is stumping me:
My Web App seems to have the correct connection string. This is exactly what Azure provides me when I click Show Connection String:
Server=tcp:myservertest.database.windows.net,1433;Initial Catalog=MyDatabaseTest;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
Here's the connection string that I put in the Visual Studio Publish Settings Default Connection setting:
Server=tcp:myservertest.database.windows.net,1433;Initial Catalog=MyDatabaseTest;Persist Security Info=False;User ID=*****;Password=***********;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
I have confirmed the username and password are correct...I used the same ones to connect via Microsoft SQL Server Management Studio.
I tried setting up the Diagnostic settings as follows, but I'm not exactly sure where I can find the resulting logs. I don't see them in Kudo services, but I believe they'd be accessed elsewhere.
Does anyone know where they're stored?
Also, what other ways could this Login failed for user error message be debugged?
The error looks like you are able to connect to the server but the server rejects the login. Debugging in the server logs would help, so you are looking at the right place.
You can enable Azure SQL Database Auditing & Threat Detection. You can enable it on SQL Server instance level by opening your SQL Server resource and selecting Security / Auditing & Threat Detection. Select a storage account to store logs in Storage details (see picture below). For more information, see https://learn.microsoft.com/en-us/azure/sql-database/sql-database-auditing.
After enabling auditing try to login to your database. After that you can find the logs in the specified Azure Storage Account in blob container named sqldbauditlogs. The logs are in folder /servername/databasename/SqlDbAuditing_ServerAudit_NoRetention/yyyy-mm-dd/ in files with xel extension. You can download and open the .xel -file in SSMS (File / Open / Fileā€¦). The xel file contains events and you can see login attempts there.
Event field succeeded tells if the login failed or not, and field server_principal_name contains the username in both cases.
From text in field additional_information you can find error_code (in the xml). Error code 40615 is blocked by firewall and code 18456 is wrong username or password. (error codes from https://learn.microsoft.com/en-us/azure/sql-database/sql-database-develop-error-messages)
You can also find some information in the database system tables for analysing the connections, e.g. sys.event_log (see: https://learn.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-event-log-azure-sql-database?view=azuresqldb-current).
More information on troubleshooting the Azure SQL Database connectivity can be found here: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-troubleshoot-common-connection-issues.
I hope this helps you forward with debugging the connection.
You've verified that Allow access to Azure services is ON. This is generally where we get tripped up. If it was coming from an outside place, we'd want to check the IP list here. Knowing that's not it, let's dig deeper.
You've gotten into the Kudu console to verify all the things. From that console, install mssql-cli. Run pip install mssql-cli from the Kudu console. If that doesn't work, look for direct urls curl or download to your PC and use the Kudu Console to upload the file into your app service.
Once you have the mssql-cli installed, try connecting with the credentials you've set in place in appSettings.json. (See https://github.com/dbcli/mssql-cli/blob/master/doc/usage_guide.md#options for command line options.) Most probably, it'll spit out a nice error message about why it can't connect, giving you more clues.
If mssql-cli connects successfully, there's something overriding your app's settings. Did you set the connection string in the Azure Portal's App Settings tab? Temporarily, you might alter your app to write portions of the connection string to an obscure page. And as soon as you get the info, DELETE THE PAGE and then change the password.
Another thing to try: grab all the details from the exception -- including Data and recursively through inner exceptions. It probably has a clue buried in there. You can remotely debug the app on Azure. Before you can debug, you'll need to ensure you've turned on remote debugging and selected the correct version of Visual Studio from the App Settings blade in your App Service.
Continue from comment - Where in Kudu would that be found? Justin in the general file explorer?
Go to Debug console > CMD - site > wwwroot - click Edit icon
Also ensure that Allow access to Azure services is ON.
Sometimes you need to check the connection string on azure application in azure. Maybe the connection string is different from the one in your web.config

Azure: Is there a way to view deployed files in Azure?

Is there a file "view" available in Azure?
When I log in to Azure to look at a website I've deployed there is no obvious see exactly what files Azure is hosting.
I can see there's the Visual Studio Online option which allows you to live edit your server code but that is more than I need. I just want to be able to check that certain files are deployed and others are not.
If you're just trying to look around, and see the various directories and files in your deployment, you can enter the site's "Kudu" dashboard, using the url format http://<yoursitename>.scm.azurewebsites.net
This will give you a web-based dashboard, including a debug console (web-based) where you can explore your various directories (and the directories will show up visually as well).
More info can be found in this post from the Azure Websites team.
In Visual Studio, in the window "Server Explorer" you click and connect on "Azure".
=> App Service
=> Your site name
=> Files
Here you see all your files and you can edit them directly in Visual Studio.
##### UPDATE 19/08/2019 #####
For some time now, it hasn't worked anymore.... :(
Here is another way to do it: By FTP !
From the Azure portal, in the "App Service" section of your website, go to "Deployment Center" > FTP > Dashboard
There is the FTPS Endpoint => ftp://.....ftp.azurewebsites.windows.net/site/wwwroot
And username, password information.
Install FileZilla Client! (https://filezilla-project.org/)
Enter Host with "FTPS Endpoint" the "username" and "password" and then login quickly!
You can use App Service Editor (previously known as Visual Studio Online). It can be found under your webapp -> Development Tools section in the Azure Portal.
I know this is old, but I just found it, and got some useful tips from it. If you are using an App Service, there is now a browser option to do this as well:
https://YourAppService.scm.azurewebsites.net/dev/wwwroot/
You can get there from the Azure portal, then go to your App service, then scroll down to Development Tools, and click on "App Service Editor".
In VS2017/2019, there's Cloud Explorer to view files in Azure, but each time open folder to view files will invoke connection to cloud, so you have to wait, that's a bit slow.
To open Cloud Explore, Right click on project > Publish > Manage in Cloud Explore, or Top Menu > View > Cloud Explorer.
Yes, you have many options to see that
By clicking Console option (run "dir" command, will list down all files)
By hitting App Service Editor(Preview) option,
Adding to the accepted answer,
you can open an ssh session by going to http://<yoursitename>.scm.azurewebsites.net/webssh/host.
For a long time, I've looked for a linux-style terminal to view my deployed files and environment variables. With this you can view the files, check and set environment variables, make db migrations directly, and a lot more. Hope this is useful.
That could be relevant: AppService->Console
You can use Visual Studio Code and the Azure extension
Since you are using Azure Websites, Azure wants to "manage" it for you, and as a result, you cannot connect to the VM itself. If you were using a Cloud Service, you can obtain the RDP information from the Azure Console and just remote into the machine.
For your situation, you can use FTP as an option. Here is blog that describes one approach:
http://blogs.msdn.com/b/avkashchauhan/archive/2012/06/19/windows-azure-website-uploading-downloading-files-over-ftp-and-collecting-diagnostics-logs.aspx
Here is another option using WebMatrix:
http://www.microsoft.com/web/post/how-to-edit-a-site-hosted-on-windows-azure-with-webmatrix

Is there any way download source code from "cloud services" in Windows Azure?

I don't have the latest version of the code deployed in the company's Windows Azure account, and I need to provide a fix to it. I know this can be done with "Azure Web Sites", but I'm not sure it's possible with "Azure Cloud Services".
Can anyone help?
If you did git deployment of the cloud service, you could fetch from the remote the same way you could with Windows Azure Web Sites. You may have updated the cloud service by uploading the package to blob storage first, in which case you could get the package. But, the package is not source code.
From a process perspective, you should label your deployments with a tag that can be matched in source control. You never know when a "hotfix" needs to be added to a branch off of the current production code.
In Windows Azure Cloud Services, instances are uploaded in the form of .cspkg packages.
According to the documentation, the Get Package operation retrieves a cloud service package for a deployment and stores the package files in Windows Azure Blob storage.
You could then download and extract this package (it is in ZIP file format) to retrieve its content. See this answer for more details.
In the case of ASP.NET applications, that will be a mixture of text files and binary assemblies (.DLLs). In the case of Java, it will be .jar files. You could use the appropriate decompiler to retrieve an approximation of the original source code. But it probably wouldn't be safe to change this reverse-engineered source code and upload it back into production, at least not without extensive testing.
yes. you can download it with an ftp client.
Ggo to dashboard of your site on https://manage.windowsazure.com.
Get credentials (username , password, host) and connect with you preferred ftp client.
Well, Azure now had a new portal and things are bit different. I had to retrieve the code for one of my websites.
To download the code,
go to App Service. In Overview panel, download publisher profile.
Now go to Deployment credentials panel. Enter the username for FTP and choose a password.
To connect to ftp, you need the URL from publishing profile (example.PublishSettings).
Now fire up your FTP client (FileZilla in my case) and put the FTP address and put the username like sitename\ftpusername (example\ftp-exmaple-user for me) and put in the password you choose in Deployment credentials panel.
wwwroot contains your code!
I realize it's an old question, in case anyone else needs it... I use the Cloud Explorer in Visual Studio 2017. In the Cloud explorer, you can drill down Subscription -> Resource Group -> App Service -> Files. Then, at the bottom of the Cloud Explorer, click "Download Files as a Zip."

New to Windows Azure Preview

3 questions about Windows Azure Website Preview service (placing my website into cloud):
1. A little embarrassing, but I can't find my FTP credential. I tried my website setup credential as well as the data source string. Both are not applicable. So where is it?
2. I also need database access too, but can't seem to find the entry URL for that as well. Any inputs are appreciated.
3. Finally, I bought my own domain. How can I do an alias (maybe from Apache or IIS, not sure though) so that users only see example.com instead of example.azurewebsites.net?
You'll find the FTP credentials in the publish profile. In the Windows Azure portal, simply open the dashboard of that site and choose Download publish profile. Open that file with any text editor and you'll see the FTP credentials.
If you want to use a database, go to the dashboard of that site and choose to add a linked resource. There you'll be able to add an SQL Database. Once you've done that you'll see the connection string under Quick Glance > View connection strings
Using your own domain with Windows Azure Web Sites is only possible with reserved instances with a CNAME.
If you want to deploy your application to Windows Azure Websites over FTP, you can take a look at my blog here which explains most of the info related to FTP deployment.
As Sandrino explained you can look at View Connections Settings at Quick Glance, also if you look at following sections in the article here you will get more on this regard:
How to: Configure a website to use a SQL database
How to: Configure a website to use a MySQL database
Rest is already answered for you.

Resources