Bu hızlı başlangıçta, Azure SQL veritabanı 'nda Azure portal, bir PowerShell betiği veya bir Azure CLı betiği kullanarak tek bir veritabanı oluşturacaksınız.In this quickstart, you create a single database in Azure SQL Database using either the Azure portal, a PowerShell script, or an Azure CLI script.Daha sonra Azure portal sorgu düzenleyicisini kullanarak veritabanını sorgulayın.You then query the database using Query editor in the Azure portal.
Azure portal tek bir veritabanı oluşturmak için bu hızlı başlangıç Azure SQL sayfasında başlatılır.To create a single database in the Azure portal this quickstart starts at the Azure SQL page.
SQL veritabanları' nın altında , kaynak türü ' nü tek veritabanı olarak ayarlayın ve Oluştur' u seçin.Under SQL databases, leave Resource type set to Single database, and select Create.
SQL veritabanı oluştur formunun temel bilgiler sekmesinde, proje ayrıntıları' nın altında, istenen Azure aboneliğini seçin.On the Basics tab of the Create SQL Database form, under Project details, select the desired Azure Subscription.
Kaynak grubu Için Yeni oluştur' u seçin, myresourcegroup girin ve Tamam' ı seçin.For Resource group, select Create new, enter myResourceGroup, and select OK.
Veritabanı adı Için mysampledatabase yazın.For Database name enter mySampleDatabase.
Sunucu Için Yeni oluştur' u seçin ve Yeni sunucu formunu aşağıdaki değerlerle doldurun:For Server, select Create new, and fill out the New server form with the following values:
Sunucu adı: te yapılandırılmış MySQLServer yazın ve benzersizlik için bazı karakterler ekleyin.Server name: Enter mysqlserver, and add some characters for uniqueness.Sunucu adları yalnızca bir abonelik içinde benzersiz değil, Azure 'daki tüm sunucular için genel olarak benzersiz olması gerektiğinden, kullanılacak tam sunucu adını sağlayamıyoruz.We can't provide an exact server name to use because server names must be globally unique for all servers in Azure, not just unique within a subscription.Bu nedenle, mysqlserver12345 gibi bir şey girin ve Portal kullanılabilir olup olmadığını bilmenize izin verir.So enter something like mysqlserver12345, and the portal lets you know if it is available or not.
Sunucu Yöneticisi oturum açma: azureuser girin.Server admin login: Enter azureuser.
Parola: gereksinimleri karşılayan bir parola girin ve Parolayı Onayla alanına yeniden girin.Password: Enter a password that meets requirements, and enter it again in the Confirm password field.
Konum: açılan listeden bir konum seçin.Location: Select a location from the dropdown list.
Tamam’ı seçin.Select OK.
SQL elastik havuz kümesini Hayır olarak kullanmak istiyor.Leave Want to use SQL elastic pool set to No.
Bu hızlı başlangıç sunucusuz bir veritabanını kullanır, bu nedenle sunucusuz' ı seçin ve Uygula' yı seçin.This quickstart uses a serverless database, so select Serverless, and then select Apply.
İleri ' yi seçin. sayfanın en altındaki Ağ.Select Next: Networking at the bottom of the page.
Ağ sekmesinde, bağlantı yöntemi için ortak uç nokta' ı seçin.On the Networking tab, for Connectivity method, select Public endpoint.
Güvenlik duvarı kuralları için, geçerli Istemci IP adresini ekle ' yi Evet olarak ayarlayın.For Firewall rules, set Add current client IP address to Yes.Azure hizmetlerinin ve kaynaklarının bu sunucuya erişmesine Izin ver ' iHayır olarak bırakın.Leave Allow Azure services and resources to access this server set to No.
Ileri ' yi seçin: sayfanın en altındaki ek ayarlar .Select Next: Additional settings at the bottom of the page.
Ek ayarlar sekmesinde, veri kaynağı bölümünde var olan verileri kullan için örnek' i seçin.On the Additional settings tab, in the Data source section, for Use existing data, select Sample.Bu, boş bir boş veritabanı aksine, sorgu yapmak ve denemek üzere bazı tablolar ve veriler için bir AdventureWorksLT örnek veritabanı oluşturur.This creates an AdventureWorksLT sample database so there's some tables and data to query and experiment with, as opposed to an empty blank database.
İsteğe bağlı olarak, Bakım penceresini , planlı bakımın veritabanınızın en iyi saatinde gerçekleştirilmesi için ayarlayın.Optionally, set the maintenance window so planned maintenance is performed at the best time for your database.
Sayfanın alt kısmındaki gözden geçir + oluştur ' u seçin:Select Review + create at the bottom of the page:
Gözden geçir + oluştur sayfasında, gözden geçirdikten sonra Oluştur' u seçin.On the Review + create page, after reviewing, select Create.
Azure Cloud Shell, bu makaledeki adımları çalıştırmak için kullanabileceğiniz ücretsiz bir etkileşimli kabuktur.The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article.Yaygın Azure araçları, kabuğa önceden yüklenmiştir ve kabuk, hesabınızla birlikte kullanılacak şekilde yapılandırılmıştır.It has common Azure tools preinstalled and configured to use with your account.
Cloud Shell'i açmak için kod bloğunun sağ üst köşesinden Deneyin'i seçmeniz yeterlidir.To open the Cloud Shell, just select Try it from the upper right corner of a code block.Ayrıca, ' a giderek ayrı bir tarayıcı sekmesinde Cloud Shell de başlatabilirsiniz https://shell.azure.com .You can also launch Cloud Shell in a separate browser tab by going to https://shell.azure.com.Kod bloklarını kopyalamak için Kopyala ' yı seçin, Cloud Shell yapıştırın ve ENTER tuşuna basarak çalıştırın.Select Copy to copy the blocks of code, paste it into the Cloud Shell, and press Enter to run it.
Parametre değerlerini ayarlaSet parameter values
Aşağıdaki değerler, sonraki komutlarda veritabanını ve gerekli kaynakları oluşturmak için kullanılır.The following values are used in subsequent commands to create the database and required resources.Sunucu adlarının, sunucu adını oluşturmak için $RANDOM işlevin kullanıldığı tüm Azure genelinde genel olarak benzersiz olması gerekir.Server names need to be globally unique across all of Azure so the $RANDOM function is used to create the server name.IP adresi aralığındaki 0.0.0.0 değerlerini, belirli ortamınızla eşleşecek şekilde değiştirin.Replace the 0.0.0.0 values in the ip address range to match your specific environment.
# Set the resource group name and location for your server
resourceGroupName=myResourceGroup
location=eastus
# Set an admin login and password for your database
adminlogin=azureuser
password=Azure1234567!
# Set a server name that is unique to Azure DNS (<server_name>.database.windows.net)
serverName=server-$RANDOM
# Set the ip address range that can access your database
startip=0.0.0.0
endip=0.0.0.0
Kaynak grubu oluşturmaCreate a resource group
az group create komutuyla bir kaynak grubu oluşturun.Create a resource group with the az group create command.Azure kaynak grubu, Azure kaynaklarının dağıtıldığı ve yönetildiği bir mantıksal kapsayıcıdır.An Azure resource group is a logical container into which Azure resources are deployed and managed.Aşağıdaki örnek eastus konumunda myresourcegroup adlı bir kaynak grubu oluşturur:The following example creates a resource group named myResourceGroup in the eastus location:
az group create --name $resourceGroupName --location $location
az sql server firewall-rule create \
--resource-group $resourceGroupName \
--server $serverName \
-n AllowYourIp \
--start-ip-address $startip \
--end-ip-address $endip
Azure CLı ile tek bir veritabanı oluşturmaCreate a single database with Azure CLI
Az SQL DB Create komutuyla bir veritabanı oluşturun.Create a database with the az sql db create command.Aşağıdaki kod oluşturulurThe following code creates
Windows PowerShell kullanarak bir kaynak grubu, sunucu ve tek veritabanı oluşturabilirsiniz.You can create a resource group, server, and single database using Windows PowerShell.
Azure Cloud Shell, bu makaledeki adımları çalıştırmak için kullanabileceğiniz ücretsiz bir etkileşimli kabuktur.The Azure Cloud Shell is a free interactive shell that you can use to run the steps in this article.Yaygın Azure araçları, kabuğa önceden yüklenmiştir ve kabuk, hesabınızla birlikte kullanılacak şekilde yapılandırılmıştır.It has common Azure tools preinstalled and configured to use with your account.
Cloud Shell'i açmak için kod bloğunun sağ üst köşesinden Deneyin'i seçmeniz yeterlidir.To open the Cloud Shell, just select Try it from the upper right corner of a code block.Ayrıca, ' a giderek ayrı bir tarayıcı sekmesinde Cloud Shell de başlatabilirsiniz https://shell.azure.com .You can also launch Cloud Shell in a separate browser tab by going to https://shell.azure.com.Kod bloklarını kopyalamak için Kopyala ' yı seçin, Cloud Shell yapıştırın ve ENTER tuşuna basarak çalıştırın.Select Copy to copy the blocks of code, paste it into the Cloud Shell, and press Enter to run it.
Parametre değerlerini ayarlaSet parameter values
Aşağıdaki değerler, sonraki komutlarda veritabanını ve gerekli kaynakları oluşturmak için kullanılır.The following values are used in subsequent commands to create the database and required resources.Sunucu adlarının tüm Azure genelinde genel olarak benzersiz olması gerekir, böylece Get-Random cmdlet 'i sunucu adını oluşturmak için kullanılır.Server names need to be globally unique across all of Azure so the Get-Random cmdlet is used to create the server name.IP adresi aralığındaki 0.0.0.0 değerlerini, belirli ortamınızla eşleşecek şekilde değiştirin.Replace the 0.0.0.0 values in the ip address range to match your specific environment.
# Set variables for your server and database
$resourceGroupName = "myResourceGroup"
$location = "eastus"
$adminLogin = "azureuser"
$password = "Azure1234567!"
$serverName = "mysqlserver-$(Get-Random)"
$databaseName = "mySampleDatabase"
# The ip address range that you want to allow to access your server
$startIp = "0.0.0.0"
$endIp = "0.0.0.0"
# Show randomized variables
Write-host "Resource group name is" $resourceGroupName
Write-host "Server name is" $serverName
Kaynak grubu oluşturmaCreate resource group
New-AzResourceGroupIle bir Azure Kaynak grubu oluşturun.Create an Azure resource group with New-AzResourceGroup.Kaynak grubu, Azure kaynaklarının dağıtıldığı ve yönetildiği bir mantıksal kapsayıcıdır.A resource group is a logical container into which Azure resources are deployed and managed.
Veritabanınız oluşturulduktan sonra veritabanına bağlanmak ve verileri sorgulamak için Azure portal sorgu düzenleyicisini (Önizleme) kullanabilirsiniz.Once your database is created, you can use the Query editor (preview) in the Azure portal to connect to the database and query data.
Portalda SQL veritabanları' nı arayıp seçin ve ardından listeden veritabanınızı seçin.In the portal, search for and select SQL databases, and then select your database from the list.
Veritabanınızın sayfasında, sol taraftaki menüden sorgu Düzenleyicisi 'ni (Önizleme) seçin.On the page for your database, select Query editor (preview) in the left menu.
Sunucu Yöneticisi oturum açma bilgilerinizi girip Tamam' ı seçin.Enter your server admin login information, and select OK.
Sorgu Düzenleyicisi bölmesine aşağıdaki sorguyu girin.Enter the following query in the Query editor pane.
SELECT TOP 20 pc.Name as CategoryName, p.name as ProductName
FROM SalesLT.ProductCategory pc
JOIN SalesLT.Product p
ON pc.productcategoryid = p.productcategoryid;
Çalıştır'ı seçip Sonuçlar bölmesindeki sorgu sonuçlarını inceleyin.Select Run, and then review the query results in the Results pane.
Sorgu Düzenleyicisi sayfasını kapatın ve kaydedilmemiş düzenlemelerinizi atmak isteyip Istemediğiniz sorulduğunda Tamam ' ı seçin.Close the Query editor page, and select OK when prompted to discard your unsaved edits.
Kaynakları temizlemeClean up resources
Kaynak grubunu, sunucuyu ve tek veritabanını bir sonraki adımlara devam etmek için ve veritabanınızı bağlanıp farklı yöntemlerle sorgulamayı öğrenin.Keep the resource group, server, and single database to go on to the next steps, and learn how to connect and query your database with different methods.
Bu kaynakları kullanmayı tamamladığınızda, oluşturduğunuz kaynak grubunu silebilirsiniz, bu da sunucuyu ve içindeki tek veritabanını da siler.When you're finished using these resources, you can delete the resource group you created, which will also delete the server and single database within it.
Azure portal kullanarak Myresourcegroup ve tüm kaynaklarını silmek için:To delete myResourceGroup and all its resources using the Azure portal:
Portalda kaynak grupları' nı arayıp seçin ve listeden myresourcegroup ' ı seçin.In the portal, search for and select Resource groups, and then select myResourceGroup from the list.
Kaynak grubu sayfasında, kaynak grubunu sil' i seçin.On the resource group page, select Delete resource group.
Kaynak grubu adını yazın altında myresourcegroup yazın ve ardından Sil' i seçin.Under Type the resource group name, enter myResourceGroup, and then select Delete.
Kaynak grubunu ve tüm kaynaklarını silmek için, kaynak grubunuzun adını kullanarak aşağıdaki Azure CLı komutunu çalıştırın:To delete the resource group and all its resources, run the following Azure CLI command, using the name of your resource group:
az group delete --name $resourceGroupName
Kaynak grubunu ve tüm kaynaklarını silmek için, kaynak grubunuzun adını kullanarak aşağıdaki PowerShell cmdlet 'ini çalıştırın:To delete the resource group and all its resources, run the following PowerShell cmdlet, using the name of your resource group: