是否可以使用存储密钥清除 azure cdn 端点?
Is it possible to purge azure cdn endpoint using storage key?
我想创建一个函数来清除 Azure CDN 上的文件。
Here 在文档中它说如何清除指定路径的内容。
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge?api-version=2017-10-12
但安全性是由 Azure Active Directory OAuth2 Flow 提供的。
因此我需要使用 clientId
、secretId
(从这里 https://blogs.msdn.microsoft.com/maheshk/2017/04/01/azure-cdn-how-to-purge-cdn-content-from-c-code/)
var authenticationContext = new AuthenticationContext("https://login.microsoftonline.com/microsoft.onmicrosoft.com");
ClientCredential clientCredential = new ClientCredential(clientId, clientSecret);
Task<AuthenticationResult> resultstr = authenticationContext.AcquireTokenAsync("https://management.core.windows.net/", clientCredential);
WebClient client = new WebClient();
//authentication using the Azure AD application
var token = resultstr.Result.AccessToken;
我在想有没有办法使用存储密钥而不是 clientId
、secretId
来发出清除请求?
不,这是不可能的。 Azure Rest API Endpoints - Purge Content
与 Azure AD 身份验证集成,它需要您的有效凭据才能获取访问令牌。
看到这个link:Getting Started with REST - Register your client application with Azure AD。
Most Azure services (such as Azure Resource Manager providers and the classic deployment model) require your client code to authenticate with valid credentials before you can call the service's API. Authentication is coordinated between the various actors by Azure AD, and provides your client with an access token as proof of the authentication. The token is then sent to the Azure service in the HTTP Authorization header of subsequent REST API requests. The token's claims also provide information to the service, allowing it to validate the client and perform any required authorization.
我想创建一个函数来清除 Azure CDN 上的文件。 Here 在文档中它说如何清除指定路径的内容。
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge?api-version=2017-10-12
但安全性是由 Azure Active Directory OAuth2 Flow 提供的。
因此我需要使用 clientId
、secretId
(从这里 https://blogs.msdn.microsoft.com/maheshk/2017/04/01/azure-cdn-how-to-purge-cdn-content-from-c-code/)
var authenticationContext = new AuthenticationContext("https://login.microsoftonline.com/microsoft.onmicrosoft.com");
ClientCredential clientCredential = new ClientCredential(clientId, clientSecret);
Task<AuthenticationResult> resultstr = authenticationContext.AcquireTokenAsync("https://management.core.windows.net/", clientCredential);
WebClient client = new WebClient();
//authentication using the Azure AD application
var token = resultstr.Result.AccessToken;
我在想有没有办法使用存储密钥而不是 clientId
、secretId
来发出清除请求?
不,这是不可能的。 Azure Rest API Endpoints - Purge Content
与 Azure AD 身份验证集成,它需要您的有效凭据才能获取访问令牌。
看到这个link:Getting Started with REST - Register your client application with Azure AD。
Most Azure services (such as Azure Resource Manager providers and the classic deployment model) require your client code to authenticate with valid credentials before you can call the service's API. Authentication is coordinated between the various actors by Azure AD, and provides your client with an access token as proof of the authentication. The token is then sent to the Azure service in the HTTP Authorization header of subsequent REST API requests. The token's claims also provide information to the service, allowing it to validate the client and perform any required authorization.