Issue with service fabric resource manager file deployment (apim.json and apim.parameters) - azure-service-fabric

My requirement is as follows:
I have an web API whose port I have removed from the ServiceManifest.xml file. This is done so that I can implement multiple node multiple calls feature from API management. (i.e. I want to remove dependency on port number)
While deploying API management resource files, I am facing issues while deploying apim.json and apim.parameters.json file.
Following is the exception I am getting always.
"Service activation failed. Please look at the details in Activity Log on the left side. In case you are deploying into VNET please make sure prerequisites are followed as described on https://aka.ms/apiminvnet"
There is nothing in the log files when I am uploading.
I am using following link for the deployment and testing. https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-deploy-api-management
I am getting exception in running powershell script
New-AzureRmResourceGroupDeployment -ResourceGroupName $groupname -TemplateFile "$templatepath\apim.json" -TemplateParameterFile "$templatepath\apim.parameters.json" -Verbose

Related

Release Agent Configuration necessary for Web App Add task

To create a directory under and add a web app to IIS, I put this script in Azure DevOps Server Deployment Group job Powershell task:
New-Item -Path "C:\inetpub\wwwroot" -Name "MyNewApp" -ItemType "directory" `
C:\Windows\system32\inetsrv\appcmd.exe add app `
/site.name:"Default Web Site" `
/path:"/MyNewApp" `
/physicalPath:"C:\inetpub\wwwroot\MyNewApp"`
When this task runs it throws an error: (timestamps removed for clarity)
APP object "Default Web Site/MyNewApp" changed
ERROR ( hresult:80090016, message:Failed to commit configuration changes.
Keyset does not exist )
After executing the above code from a Powershell console while logged in as either myself or the service account, the following messages are returned:
APP object "Default Web Site/MyNewApp" added
VDIR object "Default Web Site/MyNewApp" added
I can confirm in IIS Manager that the directory and application was created.
I cannot reproduce the error in a console. It is only when it is running as the Release Agent and initiated through the DevOps Server web interface that this error occurs.
I have tried the following:
Keyset Issue - https://support.microsoft.com/en-us/help/977754/keyset-does-not-exist-error-message-when-you-try-to-change-the-identit for both the Local Service and service accounts.
Up-to Modify permissions on C:\inetpub\wwwroot for the service account
Adding the service account to IIS Manager Permissions
Update 1:
I determined the "Keyset does not exist" error was coming from trying to use the DefaultAppPool application pool as part of the setup. This application pool was not setup with the service account but was still set with default Application Pool Identity.
However, after making this change I have a new error:
APP object "Default Web Site/MyNewApp" changed
ERROR ( hresult:80070057, message:Failed to commit configuration changes.
The parameter is incorrect. )
...
Process 'appcmd.exe' exited with code '87'.
Any guidance is greatly appreciated.
Update 2:
I logged an issue with Microsoft community that is currently being looked at. You can see it here.
You could also look at the .net implementation with the servermanager:
https://learn.microsoft.com/en-us/iis/manage/scripting/how-to-use-microsoftwebadministration
https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.administration.servermanager?view=iis-dotnet
Should not be very hard to use this in powershell.

Move-AzureRmResource fails randomly

I am trying to move Service Bus Namespace to a different resource group using powershell commands. The code below sometimes works and sometimes fails.
$Resource = Find-AzureRmResource -ResourceType "Microsoft.ServiceBus/Namespaces" -ResourceNameContains $ServiceBusNamespace
Move-AzureRmResource -DestinationResourceGroupName $ResourceGroupName -ResourceId $Resource.ResourceId -Force
And here is a random error information:
Move-AzureRmResource : ResourceMoveFailed : Resources
'/subscriptions/f24b849a-ba33-4bd9-a87e-eca0df1cbcd2/resourceGroups/Default-ServiceBus-WestEurope/providers/Microsoft.ServiceBus/namespaces/cokolwiekNamespace'
could not be moved. The tracking Id is '64c
52d24-a471-490d-b18a-b7838966a8e0'
What does the tracking Id means? Can I find it in some logs and have more meanigfull information?
Thank you for your question.
I reproduce the same error in my lab, when I try to move my service bus to destination resource group, the destination resource group’s location is different from the source resource group. In fact, there are many reasons for this error. There are some important steps to perform before moving a resource. By verifying these conditions, you can avoid errors.
More information about move resource to new resource group, please refer to the link below:
https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/
The tracking id is a randomly generated, different operations have different tracking id.
If you want to see the logs about the PowerShell, we can find the logs in localhost, run “eventvwr”, and select the “Applications and Services logs” -> “Microsoft”-> “windows” “PowerShell”-> “Operational”. like:
The picture of powershell logs in localhost
If you still have questions, welcome to post back here. Thanks.

Azure Service Fabric - change config settings for a deployed Application

How do I change settings for a deployed application in Service Fabric?
I have a provisioned cluster and an application deployed to the cluster with two applications. I would like to be able to change my services' settings and have them pick up those changes, but I don't see how I can do that.
Previously, we've done all of our services with worker roles in Cloud Services, and the portal allows for changing configurations, but it does not appear to do so for Service Fabric. From the Service Fabric Explorer I can drill down to the service, go to MANIFEST and view the XML with the settings. I just don't see a way to edit or change it. I've struggled finding anything in the SF documentation addressing this.
The portal doesn't expose a way to do this. It needs to be done via an upgrade of the application. Just change the settings in your settings XML file and perform an upgrade. In the VS publish dialog for your application project, you can update your version numbers appropriately by changing the config package version which will automatically bubble up to update the containing service and application versions.
Building on Matt Thalman's answer, here's documentation on modifying the settings in the application or service manifest XML files, updating the version numbers, and performing an application upgrade: Service Fabric application upgrade tutorial using Visual Studio. You can also perform the app upgrade using PowerShell.
Additional to above answers, adding some powershell code..
we may use below powershell code to connect to Service Fabric from powershell and get the application parameters and then update specific parameter and re deploy..
### Change the connection here (from Profile-Cloud.xml
$ConnectArgs = #{
ConnectionEndpoint="devxxxxxx.westus.cloudapp.azure.com:19000"
X509Credential="true"
ServerCertThumbprint="52BFxxxxxxxxxx"
FindType="FindByThumbprint"
FindValue="EF3A2xxxxxxxxxxxxxx"
StoreLocation="CurrentUser"
StoreName="My"
}
Connect-ServiceFabricCluster #ConnectArgs
$myApplication = Get-ServiceFabricApplication -ApplicationName fabric:/ABC.MyService
$appParamCollection = $myApplication.ApplicationParameters
### Update your parameter here..
$applicationParameterMap.ElasticSearch_Username="sachin2"
$applicationParameterMap = #{}
foreach ($pair in $appParamCollection)
{
$applicationParameterMap.Add($pair.Name, $pair.Value);
}
### Start Udpating
Start-ServiceFabricApplicationUpgrade -ApplicationName $myApplication.ApplicationName.OriginalString -ApplicationTypeVersion $myApplication.ApplicationTypeVersion -ApplicationParameter $applicationParameterMap -Monitored -FailureAction Rollback -ForceRestart $true
### Check the status until it is Ready
(Get-ServiceFabricApplication -ApplicationName fabric:/ABC.MyService).ApplicationStatus
### Check the parameters to confirm those're updated
Get-ServiceFabricApplication -ApplicationName fabric:/ABC.MyService
You may change or remove the -ForceRestart as per your requriements

Set-SPAppSiteSubscriptionName -Name "app" -Confirm:$false error in sharepoint 2013

hi I am trying several ways to configure app url, but no luck, i am trying 1.started all services like app management service,managed meta data services,Microsoft SharePoint Foundation Subscription Settings Service Application,2.and giving full controls permissions
Check that those service application are running by browsing them like this :
http://[HOST]:[PORTNUMBER]/[PoolAppId]/SubscriptionSettings.svc for Subscription Settings Service Application
http://[HOST]:[PORTNUMBER]/[PoolAppId]/AppMng.svc for App Management Service Application
because sometimes the Central Administration tells you that the services are running, but you find error logs in the event viewer saying something like the message below, to inform that your server needs more ressources to activate all services :
Error source : System.ServiceModel 4.0.0.0
WebHost failed to process a request ....
Exception : System.ServiceModel.ServiceActivationException: the service '/c720557bd2fa437c94391bd06bdb4d44/XXXXXX.svc' can't be activated due to an exception in the compilation phase.
If your server hasn't enough RAM memory, you can edit the web.config file of the desired service by modifying the balise and including this one :
<serviceHostingEnvironment minFreeMemoryPercentageToActivateService="1"/>
hope this will help you !

Trouble adding a new service

I have followed the instructions at https://github.com/cloudfoundry/oss-docs/tree/master/vcap/adding_a_system_service and copied the echo service and created my new service. (That document is somewhat out-of-date in that "excluded components" no longer exists.
In any case, my service shows up as running with a gateway and a node when I look at 'vcap status' on the server. However, when I look at 'vmc services' from the client my service is not in the list. Where is this list maintained and why is my service not on the list?
Various services, including blob, filesystem, mongodb, etc, are shown on the 'vcm services' list even though they have never been included in my config. Where is this maintained and why are other services on this list?
The cloud_controller.log file shows a "Create service request:" for echo every minute. This service is not in my config file (it was once but it was removed and I repeated the deployment). What is prompting this request for a service that was not defined in the config?
The _gateway.log for my service shows the following:
INFO -- Sending info to cloud controller: ...api.vcap.me/services/v1/offerings
INFO -- Fetching handles from cloud controller .../offerings/.../handles
ERROR -- Failed registering with cloud controller, status=400
DEBUG -- [GaaS-Provisioner] Connected to node mbus..
ERROR -- Failed fetching handles, status=404
Why does my gateway fail to register with the cloud controller? I have found some reports that suggest that the problem is with domain name mapping. I have verified that the server can find itself:
$curl api.vcap.me
Welcome to VMware's Cloud Application Platform
What can I do to register my service?
You can also try asking your question on the vcap_dev google group.
https://groups.google.com/a/cloudfoundry.org/forum/?fromgroups#!forum/vcap-dev
They are focused in answering and discussing OSS subjects for Cloud Foundry!
If you follow the document correctly things should work just fine. I understand that the mechanism for maintaining the excluded list of components has changed and can be a point of confusion when following the steps mentioned in the article (just ignore that step totally).
ERROR -- Failed registering with cloud controller, status=400
Well this is a point of worry. I recently followed the article step by step and was able to add a new service.
Is the echo service showing up in vmc services?
Have you copied the the yml files for node and gateway at ./cloudfoundry/.deployments/devbox/config?
Are the tokens for your gateway unique? and matching in the two files? ./cloudfoundry/.deployments/devbox/config/cloud_controller.yml and ./cloudfoundry/.deployments/devbox/config/**_gateway.yml**
I would recommend that you first concentrate on getting the echo service to be listed in the vmc services output. Once done with this you should replicate the steps (with absolute care to modify things like the token) to get your custom service working.
Cheers,
Ankit
You should follow this guide
It work to me.
regards.