建立新的 Azure API 管理服務執行個體Create a new Azure API Management service instance

「Azure API 管理 (APIM)」可協助組織將 API 發佈給外部、合作夥伴及內部開發人員,以發揮其資料與服務的潛力。Azure API Management (APIM) helps organizations publish APIs to external, partner, and internal developers to unlock the potential of their data and services. 「API 管理」提供的核心專長認證,透過開發人員參與、商務洞察力、分析、安全性和保護,可確保 API 程式獲致成功。API Management provides the core competencies to ensure a successful API program through developer engagement, business insights, analytics, security, and protection. APIM 可讓您為裝載於任何位置的現有後端服務,建立和管理新式 API 閘道。APIM enables you to create and manage modern API gateways for existing backend services hosted anywhere. 如需詳細資訊,請參閱概觀主題。For more information, see the Overview topic.

此快速入門描述使用 PowerShell 指令碼建立新的 API 管理執行個體的步驟。This quickstart describes the steps for creating a new API Management instance using the PowerShell scripts. 快速入門會示範如何使用可以從 Azure 入口網站執行的 Azure Cloud ShellThe quickstart shows you how to use the Azure Cloud Shell that you can run from Azure portal.

如果您沒有 Azure 訂用帳戶,請在開始前建立免費帳戶If you don't have an Azure subscription, create a free account before you begin.

注意

本文已更新為使用新的 Azure PowerShell Az 模組。This article has been updated to use the new Azure PowerShell Az module. AzureRM 模組在至少 2020 年 12 月之前都還會持續收到錯誤 (Bug) 修正,因此您仍然可以持續使用。You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. 若要深入了解新的 Az 模組和 AzureRM 的相容性,請參閱新的 Azure PowerShell Az 模組簡介To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. 如需 Az 模組安裝指示,請參閱安裝 Azure PowerShellFor Az module installation instructions, see Install Azure PowerShell.

登入 AzureLog in to Azure

https://portal.azure.com 上登入 Azure 入口網站。Log in to the Azure portal at https://portal.azure.com.

開啟 Azure Cloud ShellOpen Azure Cloud Shell

Azure Cloud Shell 是裝載於 Azure 中的互動式殼層環境,並且會透過瀏覽器來使用。Azure Cloud Shell is an interactive shell environment hosted in Azure and used through your browse. Azure Cloud Shell 可讓您使用 bashPowerShell 殼層來執行各種可與 Azure 服務搭配運作的工具。Azure Cloud Shell allows you to use either bash or PowerShell shells to run a variety of tools to work with Azure services. Azure Cloud Shell 已預先安裝一些命令,可讓您執行本文的內容,而不必在本機環境上安裝任何工具。Azure Cloud Shell comes pre-installed with the commands to allow you to run the content of this article without having to install anything on your local environment.

若要在 Azure Cloud Shell 上執行本文所包含的任何程式碼,請開啟 Cloud Shell 工作階段、使用某個程式碼區塊上的 [複製] 按鈕來複製程式碼,然後使用 Ctrl+Shift+V (在 Windows 和 Linux 上) 或 Cmd+Shift+V (在 macOS 上) 將程式碼貼到 Cloud Shell 工作階段中。To run any code contained in this article on Azure Cloud Shell, open a Cloud Shell session, use the Copy button on a code block to copy the code, and paste it into the Cloud Shell session with Ctrl+Shift+V on Windows and Linux, or Cmd+Shift+V on macOS. 貼上的文字不會自動執行,因此請按 Enter 來執行程式碼。Pasted text is not automatically executed, so press Enter to run code.

您可以使用下列方式來啟動 Azure Cloud Shell:You can launch Azure Cloud Shell with:

選項Option 範例/連結Example/Link
選取程式碼區塊右上角的 [試試看] 。Select Try It in the upper-right corner of a code block. 這__不會__自動將文字複製到 Cloud Shell。This doesn't automatically copy text to Cloud Shell. Azure Cloud Shell 的試試看範例
在瀏覽器中開啟 Azure Cloud ShellOpen Azure Cloud Shell in your browser. <a href="https://shell.azure.com" title="啟動 Azure Cloud Shell
選取 Azure 入口網站右上角功能表上的 [Cloud Shell] 按鈕。Select the Cloud Shell button on the menu in the upper-right corner of the Azure portal. Azure 入口網站中的 [Cloud Shell] 按鈕

如果您選擇在本機安裝和使用 PowerShell,本教學課程會要求使用 Azure PowerShell 模組版本 1.0 或更新版本。If you choose to install and use the PowerShell locally, this tutorial requires the Azure PowerShell module version 1.0 or later. 執行 Get-Module -ListAvailable Az 以尋找版本。Run Get-Module -ListAvailable Az to find the version. 如果您需要升級,請參閱安裝 Azure PowerShell 模組If you need to upgrade, see Install Azure PowerShell module. 如果您在本機執行 PowerShell,則也需要執行 Connect-AzAccount 以建立與 Azure 的連線。If you are running PowerShell locally, you also need to run Connect-AzAccount to create a connection with Azure.

建立資源群組Create resource group

使用 New-AzResourceGroup 來建立 Azure 資源群組。Create an Azure resource group with New-AzResourceGroup. 資源群組是在其中部署與管理 Azure 資源的邏輯容器。A resource group is a logical container into which Azure resources are deployed and managed.

New-AzResourceGroup -Name myResourceGroup -Location WestUS

建立 API 管理服務Create an API Management service

這是長時間執行的作業,而且可能需要最多 15 分鐘。This is a long running operation and could take up to 15 minutes.

New-AzApiManagement -ResourceGroupName "myResourceGroup" -Location "West US" -Name "apim-name" -Organization "myOrganization" -AdminEmail "myEmail" -Sku "Developer"

清除資源Clean up resources

當不再需要時,您可以使用 Remove-AzResourceGroup 命令來移除資源群組和所有相關資源。When no longer needed, you can use the Remove-AzResourceGroup command to remove the resource group and all related resources.

Remove-AzResourceGroup -Name myResourceGroup

後續步驟Next steps