Connecting to Azure Service Fabric cluster from Azure VM - azure

I am trying to connect to my Azure Service Fabric cluster from a new Azure virtual machine I just set up. But when I use the Connect-ServiceFabricCluster cmdlet is get the following error message:
Connect-ServiceFabricCluster : An error occurred during this operation. Please check the trace logs for more details.
At line:1 char:1
+ Connect-ServiceFabricCluster -ConnectionEndpoint ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Connect-ServiceFabricCluster], FabricException
+ FullyQualifiedErrorId : CreateClusterConnectionErrorId,Microsoft.ServiceFabric.Powershell.ConnectCluster
The command I am using in powershell is (values are obfuscated):
Connect-ServiceFabricCluster -ConnectionEndpoint {ENDPOINT ADDRESS} -FindType FindByThumbprint -FindValue {THUMBPRINT} -X509Credential -ServerCertThumbprint {THUMBPRINT} -StoreLocation CurrentUser -StoreName My
When I use the exact same command on my development PC it is working just fine. Any suggestions on what is going wrong and how I might debug this is welcome!

Ensure that you have your client certificate installed on the VM at the location indicated in the parameters to the Connect-ServiceFabricCluster cmdlet.

Related

cordova installation error -Command failed: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption The term 'Get-CimInstance' is not re

I tried to install cordova with " npm install -g cordova"
When I run the command "cordova -v" or "cordova -V" or "cordova --version"
I am getting this error.
Please help to resolve the issue
C:\Users\Admin>cordova -v
C:\Users\Admin\AppData\Roaming\npm\node_modules\cordova\node_modules\windows-release\node_modules\execa\index.js:347
throw err;
^
Error: Command failed: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption
The term 'Get-CimInstance' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
a path was included, verify that the path is correct and try again.
At line:1 char:17
+ (Get-CimInstance <<<< -ClassName Win32_OperatingSystem).caption
+ CategoryInfo : ObjectNotFound: (Get-CimInstance:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
at makeError (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4mwindows-release←[24m\node_modules\←[4mexeca←[24m\ind
ex.js:174:9)
at Function.module.exports.sync (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4mwindows-release←[24m\node_modules
\←[4mexeca←[24m\index.js:338:15)
at windowsRelease (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4mwindows-release←[24m\index.js:39:19)
at osName (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4mos-name←[24m\index.js:39:18)
at new Insight (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\node_modules\←[4minsight←[24m\lib\index.js:37:13)
at new RelentlessInsight (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\src\telemetry.js:31:1)
at Object.<anonymous> (C:\Users\Admin\AppData\Roaming\npm\node_modules\←[4mcordova←[24m\src\telemetry.js:39:15)
←[90m at Module._compile (internal/modules/cjs/loader.js:1118:30)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:982:32)←[39m {
code: ←[33m1←[39m,
stdout: ←[32m''←[39m,
stderr: ←[32m"The term 'Get-CimInstance' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if\r\n"←[39m +
←[32m' a path was included, verify that the path is correct and try again.\r\n'←[39m +
←[32m'At line:1 char:17\r\n'←[39m +
←[32m'+ (Get-CimInstance <<<< -ClassName Win32_OperatingSystem).caption\r\n'←[39m +
←[32m' + CategoryInfo : ObjectNotFound: (Get-CimInstance:String) [], CommandNotFoundException\r\n'←[39m +
←[32m' + FullyQualifiedErrorId : CommandNotFoundException\r\n'←[39m +
←[32m' \r\n'←[39m,
failed: ←[33mtrue←[39m,
signal: ←[1mnull←[22m,
cmd: ←[32m'powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption'←[39m,
timedOut: ←[33mfalse←[39m
}
C:\Users\Admin>
Get-CimInstance was introduced in Powershell v3. It was not available previously.
The rough equivalent in Powershell v2 is Get-WmiObject, but be advised that that command was superseded and deprecated by the Get-Cim* commands. As of Powershell v6, Get-WmiObject no longer exists.
Both Powershell v2 and Windows 7 are at end of life (as of January 2020), and should be considered insecure and inappropriate for contemporary usage. That said, Windows 7 does support Powershell v5 through Windows Management Framework 5.1, although Microsoft is no longer under any obligation to host that file for Windows 7 so it may not remain available.

Azure Powershell script throwing 'Forbidden'

I have a powershell script that is throwing error. I am trying to create an Alert Action Group through powershell. The last line is throwing error.
$TenantId = Get-AzTenant | select Id
Connect-AzAccount -TenantId $TenantId.Id -SubscriptionName $SubscriptionName
$Receiver1 = New-AzActionGroupReceiver -Name $ActionGroupReceiver -EmailReceiver -EmailAddress $EmailAddress
Set-AzActionGroup -Name $ActionGroup -ResourceGroup $Rg -ShortName $ActionGroupShortName -Receiver $Receiver1
I have Owner access to the subscription and can confirm that all of these variables have appropriate values.
The same code worked for a different subscription in the same tenant where I have contributor access. This is probably an access issue however I am not able to figure why I am getting Forbidden even with Owner access.
Edit - Error text
Set-AzActionGroup : Exception type: ErrorResponseException, Message:
Microsoft.Azure.Management.Monitor.Models.ErrorResponseException: Operation returned an invalid status code 'Forbidden'
at Microsoft.Azure.Management.Monitor.ActionGroupsOperations.d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Monitor.ActionGroupsOperationsExtensions.d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Monitor.ActionGroupsOperationsExtensions.CreateOrUpdate(IActionGroupsOperations
operations, String resourceGroupName, String actionGroupName, ActionGroupResource actionGroup)
at Microsoft.Azure.Commands.Insights.ActionGroups.SetAzureRmActionGroupCommand.ProcessRecordInternal()
at Microsoft.Azure.Commands.Insights.MonitorCmdletBase.ExecuteCmdlet(), Code: Null, Status code:Null, Reason
phrase: Null
At C:\Users\YashTamakuwala\Desktop\live_traffic\Alerts\Alerts\CreateActionGroup.ps1:25 char:1
Set-AzActionGroup -Name $ActionGroup -ResourceGroup $Rg -ShortName $A ...
+ CategoryInfo : CloseError: (:) [Set-AzActionGroup], PSInvalidOperationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Insights.ActionGroups.SetAzureRmActionGroupCommand
I found the problem. I tried performing the same action through portal but couldn't. Got this error.
There were policies in place to prevent such activities. Also, the requests from powershell are tracked in Activity Logs which in hindsight, I should have looked into. So I temporarily disabled the policies and was able to run the script successfully.

Couldn't find CB.Core version for flavor 'GeneralPublic' in version.json

While opening pfgold source depo, I am getting below error -
** Warning ** Desired/Active release is unknown for package [DevConsole.Bootstrapper]
E:\CxCache.A\CloudBuild.OnCorext.WwXYpYMGs_mH5zBvjOHtUA\linkpackages.ps1
: Couldn't find CB.Core version for flavor 'GeneralPublic' in
version.json At line:1 char:1
+ E:\CxCache.A\CloudBuild.OnCorext.WwXYpYMGs_mH5zBvjOHtUA\linkpackages
...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,linkpackages.ps1
Issue seems related to Cb.core version. But I dont know what steps to take?
You can upgrade the CloudBuild.OnCorext to version 4.0.2, which resolve my problems.
if you don't want to upgrade the CloudBuild.OnCorext, you can check whether the value of environment variable CloudbuildToolsFlavor is GeneralPublic. If so, you can set CloudbuildToolsFlavor as dogfood or empty.

Azure Runbook Authentication failed

I have created Azure run books under and Azure Automation account to process a large Azure Analysis services Tabular model.
When I attempt a full Tabular model process via PowerShell it times out at just after an hour of runtime.
Start: 8:47:50 AM
End: 9:48:25 AM
Command Start
Invoke-ProcessASDatabase -server "asazure://---" -DatabaseName "---" -RefreshType Full
Command End
Error Start
Invoke-ProcessASDatabase : Failed to save modifications to the server. Error returned: 'Timeout expired. The timeout
period elapsed prior to completion of the operation.. The exception was raised by the IDbCommand interface.
Technical Details:
RootActivityId: ---
Date (UTC): ---
The command has been canceled.. The exception was raised by the IDbCommand interface.
The command has been canceled.. The exception was raised by the IDbCommand interface.
The command has been canceled.. The exception was raised by the IDbCommand interface.
The command has been canceled.. The exception was raised by the IDbCommand interface.
The command has been canceled.. The exception was raised by the IDbCommand interface.
The command has been canceled.. The exception was raised by the IDbCommand interface.
'.
At line:3 char:1
Invoke-ProcessASDatabase -server "asazure://--- ...
+ CategoryInfo : InvalidArgument: (---:String) [Invoke-ProcessASDatabase],
OperationException
+ FullyQualifiedErrorId : Microsoft.AnalysisServices.PowerShell.Cmdlets.ProcessASDatabase
Error End
I then broke the process down to the partition level. The process partitions run successfully for about an hour as well processing over 100 partitions but then start getting authentication errors.
How can I get a full Tabular model process completed running under an Azure runbook?
Start: 8:59:50 PM
End: 10:06:28 PM
Command Start
Invoke-ProcessPartition -PartitionName "2018_Q4" -TableName "FACT_AR" -server "asazure://---" -Database "---" -RefreshType Full
Command End
Error Start
Invoke-ProcessPartition : Authentication failed.
Technical Details:
RootActivityId: ---
Date (UTC): ---
At line:104 char:1
Invoke-ProcessPartition -PartitionName "2018_Q4" -TableName "FACT_AR ...
+ CategoryInfo : NotSpecified: (:) [Invoke-ProcessPartition], ConnectionException
+ FullyQualifiedErrorId :
Microsoft.AnalysisServices.ConnectionException,Microsoft.AnalysisServices.PowerShell.Cmdlets.ProcessPartition
Error End
Welcome to Stack Overflow :)
Your issue looks similar to this -> Exceed 3 hours timeout Automation Runbook Azure. Please check it if the answers given in there helps to resolve your issue.
Also you may read about fair share from below Microsoft documentation.
https://learn.microsoft.com/en-us/azure/automation/automation-runbook-execution#fair-share
Hope this helps!!
It turned out the credential was somehow corrupted. Dropped the credential and re-created it and the job worked.

Set-AzureRmDiagnosticSetting : Exception type: CloudException, Message: Metric category 'AllMetrics' is not supported

I am getting below exception:
Exception type: CloudException, Message: Metric category 'AllMetrics'
is not supported.
Running Azure PowerShell command Set-AzureRmDiagnosticSetting for any Storage Account, same command works fine other resource type like Key Vault, Service Bus, Load Balancers etc.
Azure PowerShell command:
Set-AzureRmDiagnosticSetting -ResourceId $ResourceId -Enable $true
-RetentionInDays 365 -RetentionEnabled $true
Exception details:
Set-AzureRmDiagnosticSetting : Exception type: CloudException, Message: Metric category 'AllMetrics' is not
supported., Code: BadRequest, Status code:BadRequest, Reason phrase: Bad Request
At line:1 char:1
+ Set-AzureRmDiagnosticSetting -ResourceId '/subscriptions/c1ddf901-1db ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureRmDiagnosticSetting], PSInvalidOperationException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Insights.Diagnostics.SetAzureRmDiagnosticSettingCommand
Screenshot
Also tried specifying parameter -StorageAccountId $StorageAccountIdLogs with different Storage Account resource ID, still getting same exception.
Metric category 'AllMetrics' is not supported.
According to the error message, AllMetrics is not supported to Azure Storage Account.
To enable metrics of Storage Account, you could use Set-AzureStorageServiceMetricsProperty.
You could refer to my sample command, it works fine on my side.
C:\PS>$Context = New-AzureStorageContext -StorageAccountName <StorageAccountName > -StorageAccountKey <StorageAccountKey >
C:\PS>Set-AzureStorageServiceMetricsProperty -ServiceType Blob -MetricsType Hour -MetricsLevel Service -Pass Thru -RetentionDays 10 -Version 1.0 -Context $Context
For more details, refer to this article.

Resources