本文說明設定或升級 Azure 優化引擎 (AOE) 的進階案例。
使用本機儲存庫
如果您選擇從自己的本機存放庫部署所有相依性,您必須將方案檔發佈至可公開存取的 URL。 您必須確保整個 AOE 專案結構可在相同的基礎 URL 上取得。 不支援儲存帳戶的 SAS 令牌型 URL。
.\Deploy-AzureOptimizationEngine.ps1 -TemplateUri <URL to the Bicep file (for example, https://contoso.com/azuredeploy.bicep)> [-AzureEnvironment <AzureUSGovernment|AzureGermanCloud|AzureCloud>]
# Example - Deploying from a public endpoint
.\Deploy-AzureOptimizationEngine.ps1 -TemplateUri "https://contoso.com/azuredeploy.bicep"
# Example 2 - Deploying from a public endpoint, using resource tags
$tags = @{"CostCenter"="FinOps";"Environment"="Production"}
.\Deploy-AzureOptimizationEngine.ps1 -TemplateUri "https://contoso.com/azuredeploy.bicep" -ResourceTags $tags
無訊息部署
您也可以選擇使用 SilentDeploymentSettingsPath 輸入參數,以更自動化的方式部署 AOE。
參考檔案應該是 JSON 檔案,其中包含定義的所需屬性(除非指定所有必要屬性 )。
這類靜默部署檔案的內容範例如下:
{
"SubscriptionId": "<<SubscriptionId>>",
"NamePrefix": "<<CustomNamePrefix>>", // prefix for all resources. Fill in 'EmptyNamePrefix' to specify the resource names
"WorkspaceReuse": "n", // y = reuse existing workspace, n = create new workspace
"ResourceGroupName": "<<CustomName>>-rg", // mandatory if NamePrefix is set to 'EmptyNamePrefix'
"StorageAccountName": "<<CustomName>>sa", // mandatory if NamePrefix is set to 'EmptyNamePrefix'
"AutomationAccountName": "<<CustomName>>-auto", // mandatory if NamePrefix is set to 'EmptyNamePrefix'
"SqlServerName": "<<CustomName>>-sql", // mandatory if NamePrefix is set to 'EmptyNamePrefix'
"SqlDatabaseName": "<<CustomName>>-db", // mandatory if NamePrefix is set to 'EmptyNamePrefix'
"WorkspaceName": "<<ExistingName>>", // mandatory if WorkspaceReuse is set to 'n'
"WorkspaceResourceGroupName": "<<ExistingName>>", // mandatory if workspaceReuse is set to 'n'
"DeployWorkbooks": "y", // y = deploy the workbooks, n = don't deploy the workbooks
"TargetLocation": "westeurope",
"DeployBenefitsUsageDependencies": "y", // deploy the dependencies for the Azure commitments workbooks (EA/MCA customers only + agreement administrator role required)
"CustomerType": "MCA", // mandatory if DeployBenefitsUsageDependencies is set to 'y', MCA/EA
"BillingAccountId": "<guid>:<guid>_YYYY-MM-DD", // mandatory if DeployBenefitsUsageDependencies is set to 'y', MCA or EA Billing Account ID
"BillingProfileId": "ABCD-DEF-GHI-JKL", // mandatory if CustomerType is set to 'MCA"
"CurrencyCode": "EUR" // mandatory if DeployBenefitsUsageDependencies is set to 'y'
}
以無訊息方式部署 AOE 時,通常會在自動化的持續部署工作流程中發生,您可能會想要針對 Azure SQL 參數使用Microsoft Entra 驗證。 例如,若要將 SQL 系統管理員角色授予包含工作流程自動化服務主體成員的 Microsoft Entra ID 群組。 以下是範例:
.\Deploy-AzureOptimizationEngine.ps1 -SilentDeploymentSettingsPath "<path to deployment settings file>" -SqlAdminPrincipalType Group -SqlAdminPrincipalName "<Group Name>" -SqlAdminPrincipalObjectId "<Group Object GUID>"
注意
當您使用非使用者身分識別(服務主體)部署 AOE 時,您必須確保將系統身分識別指派給 AOE SQL Server,並在 Microsoft Entra ID 中賦予它 Directory Readers 角色。 請遵循在 Azure SQL 中使用 Microsoft Entra 服務主體的步驟。
啟用 Azure 承諾活頁簿
若要使用活頁簿,以分析您的 Azure 承諾使用情況(Benefits Usage、Reservations Usage 和 Savings Plans Usage)或者估算其他消費承諾的效應(Benefits Simulation 和 Reservations Potential),您需要配置 AOE 並授予其在消費合約層級(EA 或 Microsoft 客戶合約(MCA))的受控識別權限。 如果您在安裝或升級期間無法完成,仍然可以執行這些額外的設定步驟。前提是您使用的是在 AOE 資源群組中同時具有參與者身份且擁有取用合約管理許可權的使用者(EA 的 Enterprise Enrollment Administrator 或 MCA 的計費配置檔擁有者)。 您只需要使用下列語法來使用 Setup-BenefitsUsageDependencies.ps1 文稿,並回答輸入要求:
./Setup-BenefitsUsageDependencies.ps1 -AutomationAccountName <AOE automation account> -ResourceGroupName <AOE resource group> [-AzureEnvironment <AzureUSGovernment|AzureGermanCloud|AzureCloud>]
如果您遇到 Azure 價位表擷取的問題(因為 CVS 導出的大小很大),您可以建立下列 Azure 自動化 變數,以在價位表區域中篩選:AzureOptimization_PriceSheetMeterRegions設定為虛擬機的逗號分隔計費區域。 例如, 歐盟西部、歐盟和北方。
保留使用量活頁簿中有幾個「未使用的保留項」面板,需要 AOE 在 EA/MCA 層級匯出使用數據(而不是預設的訂閱層級)。 您可以藉由將AzureOptimization_ConsumptionScope(EA/MCA,需要手動將另一個計費帳戶讀取者角色授予 AOE 管理的識別)或BillingAccount(僅限 MCA)作為值來建立或更新BillingProfile自動化變數,以切換至 EA/MCA 範圍取用。 此選項可能會產生大型的單一消耗量匯出,這可能會因記憶體不足而導致錯誤(這又需要以混合式工作角色部署 AOE)。
升級 AOE
如果您有舊版的 AOE 並想要升級,就如同重新執行部署腳本一樣簡單。 使用您在初始部署中選擇的資源命名選項。 它會重新部署 ARM 範本、新增資源,以及更新現有的資源。
不過,如果您先前自訂了元件,例如自動化變數或排程,改善了使用混合式背景工作角色的作業執行效能,或透過 Private Link 強化了解決方案,那麼您應該使用 DoPartialUpgrade 參數來執行部署腳本,例如:
.\Deploy-AzureOptimizationEngine.ps1 -DoPartialUpgrade
DoPartialUpgrade開關使用時,部署只會:
- 新增記憶體容器
- 更新/新增自動化操作手冊
- 更新/新增自動化模組
- 新增自動化排程
- 新增自動化變數
- 升級 SQL 資料庫模型
- 更新 Log Analytics 活頁簿
有些客戶也可能自定義 SQL Server 部署,例如,從 SQL 資料庫 移轉至 SQL 受管理執行個體。 一旦手動完成資料庫移轉後,雖然沒有任何工具可以幫助移轉,但 AOE 升級腳本支援在開啟開關狀態下進行未來的 DoPartialUpgrade 升級 IgnoreNamingAvailabilityErrors (略過 SQL Server 命名/存在驗證)。
相關內容
相關的 FinOps 功能:
相關產品:
相關解決方案: