JetBrains DataGrip-Azure SQL-使用Active Directory连接-密码 [英] JetBrains DataGrip - Azure SQL - connect with Active Directory - Password

查看:98
本文介绍了JetBrains DataGrip-Azure SQL-使用Active Directory连接-密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用与Microsoft SQL Management Studio相同的方式连接到Azure SQL数据库-" Active Directory-密码"选项.

Is it possible to connect to Azure SQL database the same way as I would with Microsoft SQL Management Studio - the "Active Directory - Password" option.

我按照此处的说明进行操作(JetBrains文档),但是当我选择"使用Windows域身份验证"(对于Azure Active Directory应该如此)时,它不允许我像SSMS那样输入凭据.

I followed the instructions from here (JetBrains documentation) but when I select "Use Windows Domain authentication" (as I should for Azure Active Directory) it doesn't let me to enter the credentials as SSMS does.

一切对SSMS都可以正常工作,但是对DataGrip来说我没有运气.在那里不只是支持此选项吗?

Everything works fine with SSMS but with DataGrip I have no luck. Is this option just not supported in there?

推荐答案

该解决方案由 https://codejuicer.com发布/,从以下博客复制:

The solution was posted by https://codejuicer.com/, copied from following blog: https://codejuicer.com/2018/08/29/datagrip-and-azure-sql-server-active-directory-howto/

步骤1::获取一些必需的JAR.您将要使用的主要图书馆 与是ADAL4J ( https://github.com/AzureAD/azure -activedirectory-library-for-java/wiki/ADAL4J-Basics ). 我认为,执行此步骤的最简单方法是使用准系统 Maven pom.xml.这样,您无需从源代码进行编译即可查找 手动所有依赖项.霍雷!

Step 1: Get A Few Required JARs. The main library you’ll be working with is ADAL4J (https://github.com/AzureAD/azure-activedirectory-library-for-java/wiki/ADAL4J-Basics). The simplest way to do this step, in my opinion, is to use a barebones Maven pom.xml. That way you don’t have to compile from source and find all the dependencies manually. Horray!

如果您没有安装Maven( https://maven.apache.org/)你会 需要它.如果您更喜欢Gradle,我相信可以实现相同的目的 这样.

If you don’t have Maven (https://maven.apache.org/) installed you’ll need it. If you prefer Gradle, I’m sure the same can be accomplished with that.

这是我的pom.xml的样子:

This is what my pom.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>
<project
    xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.foo</groupId>
  <artifactId>bar</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
  <dependency>
          <groupId>com.microsoft.azure</groupId>
      <artifactId>adal4j</artifactId>
      <version>1.6.2</version>
  </dependency>
  </dependencies>
  <build>
    <directory>lib</directory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <configuration>
          <outputDirectory>
            ${project.build.directory}
          </outputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

现在,无论您的pom.xml位于何处,都运行此命令:

Now run this command wherever your pom.xml is at:

mvn clean dependency:copy-dependencies

它将创建一个"lib"目录,其中包含您需要的所有jar.

It will create a "lib" directory containing all the jars you need.

步骤2:将JAR添加到Azure(Microsoft)驱动程序 1.在数据源和驱动程序"窗口(文件"菜单)中,选择"Azure(Microsoft)"驱动程序.在驱动程序文件窗格中,单击+按钮 然后选择自定义JAR ..." 2.导航到在步骤1中获取的JAR.选择所有的JAR. 您的屏幕应显示为 像这样的东西(除了花哨的模糊来隐藏我的超级 机密信息). 步骤3:更改高级连接选项只有一个 Active Directory身份验证需要更改的内容.这 身份验证方法.真的很简单.

Step 2: Add the JARs to the Azure (Microsoft) Driver 1. In the Data Sources and Drivers window (File menu), select the Azure (Microsoft) driver. In the Driver files pane, click the + button and select "Custom JARs..." 2. Navigate to the JARs fetched in Step 1. Select all of them. Your screen should look something like this (aside from the fancy blurs to hide my super secret info). Step 3: Altering the Advanced Connection Options There is only one thing you need to change for Active Directory authentication. The authentication method. It’s really easy.

目前,我假设您已经建立了连接.如果不, 创建一个并选择Azure(Microsoft)驱动程序.

At this point, I’m assuming you have an existing connection. If not, create one and select the Azure (Microsoft) driver.

导航到高级"选项卡.我喜欢按名称对选项进行排序. 不管您执行什么操作,请找到名为"authentication"的设置.

Navigate to the Advanced tab. I like to sort the options by Name. However you do it, find the setting named "authentication."

单击值"列,然后选择ActiveDirectoryPassword(如果 您使用Windows™并使用集成的AD…选择 ActiveDirectoryIntegrated). 我想我不必告诉您单击确定"或应用".

Click in the Value column and select ActiveDirectoryPassword (if you’re on Windows™ and use integrated AD… select ActiveDirectoryIntegrated). I imagine I don’t have to tell you to "click OK or Apply."

成功(我希望)!此时,您应该可以登录到 数据库实例.当然,这是假设您的凭据和 主机名正确.我希望这会有所帮助!

Success (I hope)! At this point you should be able to log in to your database instance. Of course, that assumes your credentials and hostname are correct. I hope this helps!

这篇关于JetBrains DataGrip-Azure SQL-使用Active Directory连接-密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆