在Azure Classic/Service Management中,Get-AzureSubscription将在租户中提供订阅列表,其中包含哪个订阅是最新的.
还有一个Get-AzureSubscription -Current标志可以为您提供当前订阅.
有没有办法在AzureRM.Profile中找到当前订阅?
简短的问题:
2015年4月20日之后,是否有人使用Google Custom Search Api进行身份验证?
更长的版本:
我正在尝试使用Google Custom Search Api来请求按需索引.在我开始之前,我遇到了身份验证问题.根据文档,您应该使用ClientLogin Api进行身份验证.这个Api于2015年4月20日关闭,当你尝试从中获取令牌时它现在返回404.
ClientLogin 文档上的弃用通知声明使用Oauth.
因此,我试图验证几乎一样侯赛因在这里 我收到了来自谷歌的承载令牌,但是当我尝试做一个请求,我收到了401以下消息
<Error>You are not authorized to access this resource. If you feel this is an error, try re-logging into your Google Account.</Error>
Run Code Online (Sandbox Code Playgroud)
这并不奇怪,因为没有最新文档,我盲目地试图寻找正确的解决方案.
我目前在C#中的代码:
private static async Task Run()
{
var credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer("blablabla@developer.gserviceaccount.com")
{
Scopes = new[] { "https://www.googleapis.com/auth/cse" }
}.FromPrivateKey("-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----\n"));
await credential.RequestAccessTokenAsync(CancellationToken.None);
var token = credential.Token;
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = …Run Code Online (Sandbox Code Playgroud) google-api google-search-api google-custom-search google-oauth2
我们目前正在使用基于MVC4/Umbraco的项目,使用Azure网站来托管它.
我们使用SCM_BUILD_ARGS在不同的构建设置之间进行更改,具体取决于我们部署到Azure的哪个站点(Test and Prod).
这是通过在UI中定义应用程序设置来完成的:
SCM_BUILD_ARGS =/p:环境=测试
之前我们使用Bitbucket Integration进行部署,这里的设置就像一个冠军.
我们现在已经切换到使用Git Deployment,在测试通过后从我们的构建服务器推送更改.但是当我们这样做时,我们会得到一个可爱的错误.
"MSB1008:只能指定一个项目."
尝试从Azure上的UI重新部署相同的失败部署.
经过一些试验和错误,我结束了进入deploy.cmd并输出%SCM_BUILD_ARGS%脚本中的值.它似乎/从SCM_BUILD_ARGS中删除,但仅在使用Git部署时,而不是Bitbucket Integration或从UI重新部署.
作为解决方法我现在已经添加了一个/到前面的deploy.cmd脚本%SCM_BUILD_ARGS%,但这当然会中断重新部署,因为我们//p:Environment=Test在%SCM_BUILD_ARGS%插入值时在MSBuild命令中有.
:: 2. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
:: Added / to SCM_BUILD_ARGS
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\www\www.csproj" [....] /%SCM_BUILD_ARGS%
) ELSE (
%MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\www\www.csproj" [....] /%SCM_BUILD_ARGS%
)
Run Code Online (Sandbox Code Playgroud)
任何人都知道这个问题的更好的解决方案或者它可能是Kudu的一个错误?我们希望从Git和Redeploy部署工作.