简体   繁体   English

如何在Azure中使用API​​创建防火墙规则?

[英]how to create Firewall Rules with API in Azure?

I need to create Firewall Rules in a database in Azure, to allow certain ips to access, I found that documentation but I do not know exactly what steps to do. 我需要在Azure的数据库中创建防火墙规则,以允许某些ip访问,但我发现了该文档,但我不知道该怎么做。

https://docs.microsoft.com/es-es/rest/api/sql/firewallrules/createorupdate https://docs.microsoft.com/es-es/rest/api/sql/firewallrules/createorupdate

I already know how to consume a service using GET, PUT, POST, or DELETE. 我已经知道如何使用GET,PUT,POST或DELETE使用服务。 but for more that I send the POST it returns this to me. 但是对于我发送的更多信息,POST将其返回给我。

在此处输入图片说明

I think I need to send the credentials, before sending the POST 我认为我需要先发送凭据,然后再发送POST

How to do this? 这个怎么做? the other question is that I do not want to do it directly from the portal, because I need a program that I am developing to do it through the consumption of the API 另一个问题是我不想直接从门户网站进行操作,因为我需要一个正在开发的程序来通过使用API​​来执行此操作

you need to use your subscription id, not your subscription name: 您需要使用您的订阅ID,而不是您的订阅名称:

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/firewallRules/{firewallRuleName}?api-version=2014-04-01
                            ^ put resourceId here

easiest way to retrieve that - go to that portal to the sql server in question and look up the url. 最简单的检索方法-转到有问题的sql server的门户并查找url。 it will be the exact same url (except for the first part). 它将是完全相同的网址(第一部分除外)。 here's url from the portal for kv resource: 以下是kv资源门户网站的网址:

https://portal.azure.com/resource/subscriptions/xxx/resourceGroups/infrastructure/providers/Microsoft.KeyVault/vaults/yyy/overview
                                 ^ this is where the resourceId starts

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 azure上的防火墙规则 - Firewall Rules on azure 如何使用 python 更新 azure vm 防火墙入站端口规则 - how to update azure vm firewall inbound port rules using python 如何通过 Powershell 启用 Azure 应用程序网关上的所有防火墙规则? - How to enable all the firewall rules on Azure Application Gateway via Powershell? 如何监视对 Azure 存储帐户防火墙规则所做的更改并发出警报 - How to monitor and alert on changes made to Azure Storage Account Firewall rules Java-以编程方式添加SQL Azure防火墙规则 - Java - Adding SQL Azure Firewall rules programmatically VSTS Azure PowerShell任务SQL防火墙规则 - VSTS Azure PowerShell Task SQL Firewall rules 尝试使用 Azure ARM 中的引用函数创建基于资源属性的防火墙规则时出现无效 Json 错误 - invalid Json error when trying to use the reference function in Azure ARM to create firewall rules based on resource property 新门户网站上的SQL Azure防火墙规则(2014) - SQL Azure Firewall Rules on New Portal (2014) 使用防火墙规则在存储上备份 azure 分析服务 - Backup azure analysis service on a storage with firewall rules 新门户上的SQL Azure防火墙规则 - SQL Azure Firewall Rules on New Portal
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM