SQLPackage and DB on Azure - sqlpackage

I am running sqlpackage from commandline:
sqlpackage.exe /action:Extract /TargetFile:"C:\file.dacpac" /sourceDatabasename:dbsorgente /sourceservername:dummy.database.windows.net /p:ExtractAllTableData=True
and I get error:
[Windows logins are not supported in this version of SQL Server]
The db is on Azure and from Sql Management STudio I can successfully connect to it.
Can you help me ?

You need to specify also /SourceUser: and /SourcePassword: in your command, otherwise it will use Windows login to authenticate to source server.
So your command should look like:
sqlpackage.exe /action:Extract /TargetFile:"C:\file.dacpac" /sourceDatabasename:dbsorgente /sourceservername:dummy.database.windows.net /sourceuser=yourUser /sourcePassword=yourPassword /p:ExtractAllTableData=True

Related

SQL Server on Kubernetes (aks) login for SA failed

I am trying to deploy a custom SQL Server 2019 docker image from my docker hub repository to a kubernetes cluster (aks) but not able to log in to the DB instance from outside. It says login for user 'sa' failed.
I have verified the password requirements and literally tried using the same used in Microsoft docs but still can't log in to SQL Server.
Tried using sqlcmd and Azure Data Studio and I know it is reaching the server because the errorlog has the following error:
Error: 18456, Severity: 14, State: 8Login failed for user 'sa'. Reason: Password did not match that for the login provided.
Tested the same passwords, in my local docker environment and incidently, all of them gave the same error whenever I spun the container. After a few options, I used a simple password which worked locally and in k8s as well.
Have raised an SR with MS to understand password policy reqs. as to why some passwords didn't work. Event the one provided in their docs.
Thanks #Larnu and #Aaron Bertrand for your time and inputs.

unable to deploy .net project using TFS IIS app deployment task

I am trying to deploy my project to IIS using TFS Winrm:IIS web app deployment task. I am new to this.
I am getting the following error'
"Deployment failed on machine xxx with following message : System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server xxx failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". "
I was able deploy the project to the same remote server using TFS Winrm: windows machine file copy task which is the prior step for web app deployment to IIS. Winrm service is running and when it type the "winrm quickconfig i am getting "winrm is already been configured".
What am i missing here ? please suggest. Thanks in advance.
The Winrm:IIS task is actually MSDeploy from Machine A to Machine B so for this to work you need to install MSDeploy on Machine B. You should then be ok to deploy from Machine A. Check this article out for more information and to see if you have all the pre-requisite. Also these articles have a bit more info.
https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/cd/deploy-webdeploy-iis-winrm?view=azure-devops
https://marketplace.visualstudio.com/items?itemName=ms-vscs-rm.iiswebapp
The issue was resolved when i enable remote powershell remoting my remote machine using the command Enable-PSRemoting –force

Visual Studio Team Services error: "The target of the specified cmdlet cannot be a Windows client-based operating system."

When I try to deploy my artifact on IIS, I am getting the error as shown in the below screenshot. Any help will be greatly appreciated.
The "IIS Web App Management" screenshot is shown below:
The error message is pretty clear: You can't use it to install IIS on a client OS (such as Windows 10). You have to use a server OS (such as Windows Server).
There's nothing you can do about it other than to use a server OS or use an alternate tool to deploy.
Using Windows Remote Management (WinRM), connect to the host
machine(s) where IIS or SQL Server is installed, and manage the Web
application or deploy the SQL Server Database as described below:
Create a new website or update an existing website using AppCmd.exe.
Create a new application pool or update an existing application pool using AppCmd.exe.
Deploy a Web Application to the IIS Server using Web Deploy.
Deploy a SQL Server Database using DACPAC and SqlPackage.exe.
Your log mentioned the task was installing IIS, and it seemed the tasking was installing IIS on a windows client OS. You need to check your target machine to see whether it has IIS installed.

Visual Studio 2017 Web App with SQL Authentication Error 52

I am trying to publish a VS2017 web app to a godaddy domain with authentication on a remote SQL server. The app works fine when run from the Visual Studio environment. I can log in, register, etc and see the data on my SQL Server. When deployed I get ::
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
Fixed - I discovered that the web.config file on the domain server did not get updated with the proper connection string.

Connecting to LocalDB from Visual Studio Online Build Server

I have a library project that has a local MDF file (LocalDB) and uses the following connectionstring:
Data Source=(LocalDb)\v11.0;Initial Catalog=MyDB;Integrated Security=True
The code needs to access the DB in compilation time (F# Type Provider). It works fine locally but it fails when it is compiled on the Visual Studio Online Build Server (TFS) with the following error:
Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=26085; handshake=248;
I checked and it looks like LocalDB is installed on the build servers: http://listofsoftwareontfshostedbuildserver.azurewebsites.net/
Any ideas? Do I need special permissions to access LocalDB?
Thanks!
I had a similar problem and I solved it by initializing LocalDb in a post-build event. You might need to put it in a pre-build event if your build itself is accessing the database.
I wanted to have a dynamic LocalDb database created every build in order to access it from my unit test suite. I decided to use the RimDev.AutomationSql package to allow my unit tests to programmatically create the LocalDb instance rather than checking in a .mdf file. (See http://www.nuget.org/packages/RimDev.Automation.Sql/)
According to the RimDev.Automation.Sql github readme, https://github.com/ritterim/automation-sql, even though LocalDb is installed, it may not be initialized.
You may have LocalDB installed, but never initialized the instance on
your machine. Run this command via command prompt.
LocalDB SQL Express 2014
"C:\Program Files\Microsoft SQL Server\120\Tools\Binn\SqlLocalDB.exe"
create "v12.0" 12.0 -s
LocalDB SQL Express 2012
"C:\Program Files\Microsoft SQL Server\110\Tools\Binn\SqlLocalDB.exe"
create "v11.0" 11.0 -s

Resources