[解決] Update-database 時遇到錯誤訊息: Cannot open server requested by the login. Client with IP address is not allowed to access the server.
簡單的描述一下遇到的狀況 Azure上面有一個我新建的Database, 當我試著使用Entity Framework Code Migration去更新資料的時候, add-migration initialModels update-database visual studio 卻拋出以下的錯誤訊息 Cannot open server 'avbotdata' requested by the login. Client with IP address '108.123.1.251' is not allowed to access the server. To enable access, use the Windows Azure Management Portal or run sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address range. It may take up to five minutes for this change to take effect. 原因很明顯, 我們想要存取資料庫的時候, Azure 認為發出請求的IP不在Whitelist裡面, 所以擋住了update的請求 解法其實很簡單 Step 1. 選擇你要設定的資料庫, 在搜尋列上輸入 Firewall Step 2. 輸入你要加入的IP後存檔