Giter Site home page Giter Site logo

startstopv2-deployments's Introduction

Start/Stop VMs during off-hours overview (V2)

The Start/Stop VMs during off-hours feature starts or stops enabled Azure VMs. It starts or stops machines on user-defined schedules, provides insights through Azure Application Insights, and sends optional emails by using action groups. The feature can be enabled on both Azure Resource Manager and classic VMs for most scenarios.

V2 User Guide: https://docs.microsoft.com/azure/azure-functions/start-stop-vms/overview

Note: Before you deploy this solution into your Azure subscription, please make sure you have owner permission at the subscription level.

Global Azure

Get Latest Version (Existing Users)

Customers who have already deployed our Start/Stop V2 solution from the marketplace can use the below link to get the latest version. Please make sure you pass all the resource names correctly by referring to your existing deployment. This is a one-time manual effort for existing users to get the latest version, and from there you can configure the auto-update feature to get the latest version automatically.

Note: Running this template replaces previous files in the Function App, if updated file versions are available. To ensure that the file deployment is successful, we recommend that you stop the Function App before you run this template. After the template finishes running, you can start the Function App.

Deploy to Azure

Fairfax/USGOV

Get Latest Version (Existing Users)

Customers who have already deployed our Start/Stop V2 solution from the marketplace can use the below link to get the latest version. Please make sure you pass all the resource names correctly by referring to your existing deployment. This is a one-time manual effort for existing users to get the latest version, and from there you can configure the auto-update feature to get the latest version automatically.

Note: Running this template replaces previous files in the Function App, if updated file versions are available. To ensure that the file deployment is successful, we recommend that you stop the Function App before you run this template. After the template finishes running, you can start the Function App.

Deploy to Azure

Enable Multi-Subscription Support

After the start/stop deployment is completed, please follow the steps below to enable the feature to take action across multiple subscriptions:

  1. Copy the name of the Azure function that you had created during the deployment
  2. Navigate to your secondary subscription --> Select the subscription ---> Click on Access Control (IAM)
  3. Click the button "Add role assignments"
  4. Select the "contributor" role from the dropdown
  5. Enter the name of the Azure function in the "Select search by name or email address" box. Select the function name
  6. Click the Save button

Upcoming or recent updates to Start/Stop V2

Start/Stop V2 currently runs on .NET 6 using the in-process Functions model. Before the respective retirement dates for .NET 6 support and in-process support, we are planning to update Start/Stop V2 so that it remains on supported versions. No dates are confirmed yet for making the new .NET version or isolated process updates available for Start/Stop V2, but we will update this page once these updates are available.

February 13, 2024 Workspace-based Application insights is now available for Start/Stop v2

Updating Start/Stop v2

To update an existing Start/Stop v2 solution that you deployed, you can run the TriggerAutoUpdate Function either manually or let it run automatically on schedule. By default, it runs daily.

Known issues

  • The CostAnalyticsFunction and SavingsAnalyticsFunction functions might return failures such as 429 Too Many Requests errors. There is no ETA for fixing this issue, but this function does not impact the functionality of the Start/Stop V2 solution. This function is used by Microsoft to estimate aggregate savings of Start/Stop V2 across customers.

Customer Support Contact

Please follow the steps below if you want to submit a support ticket from the Azure portal:

  1. Go to https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview (if public cloud) or https://portal.azure.us/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/overview (if US Government cloud)
  2. Click Create a support request
  3. In the Summary field, provide a description of the issue
  4. In the Issue type field, select Technical
  5. Select the subscription that you deployed to
  6. Select All services
  7. Select Start-Stop V2
  8. Select the appropriate topic from the list
  9. Follow the remaining steps in the form to create the support ticket

Microsoft Open Source Code of Conduct

https://opensource.microsoft.com/codeofconduct

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademark

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

startstopv2-deployments's People

Contributors

awaadhwa avatar balas77 avatar gabesmsft avatar jeffw16 avatar joaosaffran avatar microsoftopensource avatar parojasmsft avatar robertoregh avatar svarga-msft avatar svenaelterman avatar tomverhoeff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

startstopv2-deployments's Issues

Bad Request for Virtual Machine Scale Sets

Hi! Hope you can assist, I'm receiving Bad Request when trying to implement this on our virtual machine scale set

INPUT

"function": {
    "name": "stagingStartStopVM-FAvglt7nztx34dk/Scheduled",
    "id": "/subscriptions/XXXXXXXXXXXXXXX/resourceGroups/XXXXX_STAGING/providers/Microsoft.Web/sites/stagingStartStopVM-FAvglt7nztx34dk/functions/Scheduled",
    "type": "Microsoft.Web/sites/functions"
},
"body": {
    "Action": "stop",
    "EnableClassic": false,
    "RequestScopes": {
        "ExcludedVMLists": [],
        "VMLists": [         "/subscriptions/XXXXXXXXXXXXXXX/resourceGroups/XXXXX_STAGING/providers/Microsoft.Compute/virtualMachineScaleSets/stgngnode/virtualMachines/0",             "/subscriptions/XXXXXXXXXXXXXXXresourceGroups/XXXXX_STAGING/providers/Microsoft.Compute/virtualMachineScaleSets/stgngnode/virtualMachines/1",    "/subscriptions/XXXXXXXXXXXXXXX/resourceGroups/XXXXX_STAGING/providers/Microsoft.Compute/virtualMachineScaleSets/stgngnode/virtualMachines/2"
        ]
    }
}

}

OUTPUT

{
    "statusCode": 400,
    "headers": {
        "Request-Context": "appId=cid-v1:9512cdc1-d4d2-40bc-be4c-e2ac00c2a572",
        "X-Content-Type-Options": "nosniff",
        "Date": "Fri, 17 Sep 2021 09:39:08 GMT",
        "Content-Length": "428",
        "Content-Type": "application/json; charset=utf-8"
    },
    "body": {
        "successful": false,
        "message": "Encountered a request scope with an invalid value. The provided resource ARM URI /subscriptions/XXXXXXXXXXXXXXX/resourceGroups/XXXXX_STAGING/providers/Microsoft.Compute/virtualMachineScaleSets/stgngnode/virtualMachines/0 is invalid. Uri should contain a provider of type /providers/Microsoft.Compute/virtualMachines or /providers/Microsoft.ClassicCompute/virtualMachines."
    }
}

Is there anyway to make this work for VMSS? Thanks!

RoleAssignmentUpdateNotPermitted

Deployment fails with the following error
Account used was subscription owner

Microsoft.Authorization/roleAssignments

{
    "status": "Failed",
    "error": {
        "code": "RoleAssignmentUpdateNotPermitted",
        "message": "Tenant ID, application ID, principal ID, and scope are not allowed to be updated."
    }
}

Schedule Stop/Start for Tagged VMs

Hey team! This is a great improvement of the previous version and seems great, but there is a feature missing that I really miss. Can we do something either in the json or somewhere else, so we can shut down vms automatically in a subscription if they have x tag?

Error while running stop or start logic app

I am getting the following error while running the start or stop logic app. I already checked and both the fuction and logic app have contributor at the subscription level

{
"runStatus": "Failed",
"runError": {
"code": "500",
"message": "{"Message":"An error has occurred.","ExceptionMessage":"The client '7e57365d-2eec-476b-8d15-72291373ff8d' with object id '7e57365d-2eec-476b-8d15-72291373ff8d' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resources/read' over scope '/subscriptions/f3533fa8-fb94-4f09-98c6-e33601edeb74' or the scope is invalid. If access was recently granted, please refresh your credentials.","ExceptionType":"Microsoft.Rest.Azure.CloudException","StackTrace":" at Microsoft.Azure.Management.ResourceManager.Fluent.ResourcesOperations.ListWithHttpMessagesAsync(ODataQuery1 odataQuery, Dictionary2 customHeaders, CancellationToken cancellationToken)\r\n at Microsoft.Azure.Management.ResourceManager.Fluent.ResourcesOperationsExtensions.ListAsync(IResourcesOperations operations, ODataQuery1 odataQuery, CancellationToken cancellationToken)\\r\\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionArmVirtualMachinesAsync(String subscriptionId) in D:\\\\a\\\\1\\\\s\\\\StartStopAzureFunctions\\\\Clients\\\\AzureVirtualMachineClient.cs:line 109\\r\\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionVirtualMachinesAsync(String subscriptionId, Boolean classicEnabled) in D:\\\\a\\\\1\\\\s\\\\StartStopAzureFunctions\\\\Clients\\\\AzureVirtualMachineClient.cs:line 98\\r\\n at StartStopAzureFunctions.BusinessLogic.UserRequestTranslatorBL.GetAccessibleVmsForSubscriptionScopesAsync(IEnumerable1 subscriptionIds, Boolean classicEnabled) in D:\\a\\1\\s\\StartStopAzureFunctions\\BusinessLogic\\UserRequestTranslatorBL.cs:line 70\r\n at StartStopAzureFunctions.Workflows.VirtualMachineScheduledRequestWorkflow.StartWorkflowAsync(ScheduledRequest scheduledRequest) in D:\\a\\1\\s\\StartStopAzureFunctions\\Workflows\\VirtualMachineScheduledRequestWorkflow.cs:line 83\r\n at StartStopAzureFunctions.ScheduledRequestFunction.RunAsync(ScheduledRequest scheduledRequest) in D:\\a\\1\\s\\StartStopAzureFunctions\\ScheduledRequestFunction.cs:line 32"}"
}
}

How to deploy this solution using BICEP ?

  1. I want to automate the process of deploying the solution template. Can you guide on how to do this?
    I can see that I can download the template while deploying the solution from portal. Can I simply convert that ARM template to bicep and automate it ?

  2. I can see that function app uses basis comsumption plan . I want to have private endpoint and VNET integration for function app . Can I upgrade the app service plan to premium . Also if I enable privateendpoint and VNET integration in functionapp , will the logic app be able to contact function app ( HTTP trigger) ?? .

Schedules not being triggered

Hi

I completed the configuration for start and stop under schedule, configured start time to avoid logic app to run after enabling it, nothing happened when schedule was reached, i had to manually trigger the logic app to make it worth, happened on stop and start logic apps.

Thanks

Scheduled jobs / runbook are not running

I am using Start/ Stop VM version 2, I am creating this case based on following link
https://docs.microsoft.com/en-us/azure/azure-functions/start-stop-vms/overview

Question: Are you using the Start Stop Solution, or a custom script?
Answer: I am using the Start-Stop VM Solution

Question: When did the problem begin?
Answer: Thu, Sep 2, 2021, 12:00 AM EDT

Question: Details
Answer: Starting from 2nd September Scheduled job / runbook is not working to start the VM, we are performing manual start. You can find last sucessfull job details below.

ScheduledStartStop_Child
9/2/2021, 9:30:54 PM
Completed
Azure
9/2/2021, 9:33:03 PM
ScheduledStartStop_Parent

The subscription 'Sub id' could not be found."

Hello:

I am trying to use the function app in Azure Gov using the payload below, and I keep getting an error that the subscription is not found. Is this not usable on Azure Government?

{
"Action": "start",
"EnableClassic": false,
"RequestScopes": {
"ExcludedVMLists": [],
"Subscriptions": [
"/subscriptions/my-subscription-id/"
]
}
}

"StackTrace": " at Microsoft.Azure.Management.ResourceManager.Fluent.ResourcesOperations.ListWithHttpMessagesAsync(ODataQuery1 odataQuery, Dictionary2 customHeaders, CancellationToken cancellationToken)\r\n at Microsoft.Azure.Management.ResourceManager.Fluent.ResourcesOperationsExtensions.ListAsync(IResourcesOperations operations, ODataQuery1 odataQuery, CancellationToken cancellationToken)\r\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionArmVirtualMachinesAsync(String subscriptionId) in D:\\a\\1\\s\\StartStopAzureFunctions\\Clients\\AzureVirtualMachineClient.cs:line 110\r\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionVirtualMachinesAsync(String subscriptionId) in D:\\a\\1\\s\\StartStopAzureFunctions\\Clients\\AzureVirtualMachineClient.cs:line 98\r\n at StartStopAzureFunctions.BusinessLogic.UserRequestTranslatorBL.GetAccessibleVmsForSubscriptionScopesAsync(IEnumerable1 subscriptionIds) in D:\a\1\s\StartStopAzureFunctions\BusinessLogic\UserRequestTranslatorBL.cs:line 82\r\n at StartStopAzureFunctions.Workflows.VirtualMachineScheduledRequestWorkflow.StartWorkflowAsync(ScheduledRequest scheduledRequest) in D:\a\1\s\StartStopAzureFunctions\Workflows\VirtualMachineScheduledRequestWorkflow.cs:line 81\r\n at StartStopAzureFunctions.ScheduledRequestFunction.RunAsync(ScheduledRequest scheduledRequest, CloudQueue orchestrationRequestQueue, CloudTable requestStoreTable) in D:\a\1\s\StartStopAzureFunctions\ScheduledRequestFunction.cs:line 41"
}

Did anyone get this to work ?

When trying to have a few vms stopped the logic app runs into this error:

{
"Message": "An error has occurred.",
"ExceptionMessage": "Response status code does not indicate success: 400 (Bad Request).",
"ExceptionType": "System.Net.Http.HttpRequestException",
"StackTrace": " at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\r\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionClassicVirtualMachinesAsync(String subscriptionId) in D:\a\1\s\StartStopAzureFunctions\Clients\AzureVirtualMachineClient.cs:line 151\r\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionVirtualMachinesAsync(String subscriptionId) in D:\a\1\s\StartStopAzureFunctions\Clients\AzureVirtualMachineClient.cs:line 99\r\n at StartStopAzureFunctions.BusinessLogic.UserRequestTranslatorBL.GetAccessibleVmsForSubscriptionScopesAsync(IEnumerable`1 subscriptionIds) in D:\a\1\s\StartStopAzureFunctions\BusinessLogic\UserRequestTranslatorBL.cs:line 82\r\n at StartStopAzureFunctions.Workflows.VirtualMachineScheduledRequestWorkflow.StartWorkflowAsync(ScheduledRequest scheduledRequest) in D:\a\1\s\StartStopAzureFunctions\Workflows\VirtualMachineScheduledRequestWorkflow.cs:line 81\r\n at StartStopAzureFunctions.ScheduledRequestFunction.RunAsync(ScheduledRequest scheduledRequest) in D:\a\1\s\StartStopAzureFunctions\ScheduledRequestFunction.cs:line 40"
}

Unable to redeploy solution

Hello,

First of all thank you for this solution, it's great, however I needed to remove it and redeploy it and the deployment fails. I have tried redeploying this on 2 tenants now (different subscriptions completely) and get the same issue.

I get bad requests on 3 of the functions as follows:

{
"status": "Failed",
"error": {
"code": "BadRequest",
"message": "Scope can not be updated"
}
}

After this I deleted the entire resource group I was deploying to and tried again to a new resource group, it got further but still failed, this time with:

"status": "Failed",
"error": {
    "code": "RoleAssignmentUpdateNotPermitted",
    "message": "Tenant ID, application ID, principal ID, and scope are not allowed to be updated."

Although this time all resources seemed to be deployed, when attempting to start a VM it failed with:

{
"Message": "An error has occurred.",
"ExceptionMessage": "The client 'xxx' with object id 'xxx' does not have authorization to perform action 'Microsoft.Resources/subscriptions/resources/read' over scope '/subscriptions/xxx' or the scope is invalid. If access was recently granted, please refresh your credentials.",
"ExceptionType": "Microsoft.Rest.Azure.CloudException",

Please help, I am not doing anything differently to when I initially deployed it to either tenant, it just isn't redeploying, is there some role or something I need to remove prior to redeploying?

Many thanks in advance!

Please update documentation for support.

Hello! Could you update whichever is incorrect below, please?

I see on the Troubleshooting page, https://docs.microsoft.com/en-us/azure/azure-functions/start-stop-vms/troubleshoot, under Next Steps:
If you run into problems during deployment, you encounter an issue when using Start/Stop VMs v2 (preview), or if you have a related question, you can submit an issue on GitHub. Filing an Azure support incident from the Azure support site is not available for this preview version.

On the github page, https://github.com/microsoft/startstopv2-deployments#customer-support-contact, you say to open a Support case.

Thank You!

Classic App Insights

Hi, it looks like the current deployment creates classic Application Insights resources.
Are there any plans to support creating a workspace-based AI resource with the start/stop v2 feature in the future?
Please contact me internally at v-dibr if needed, this is related to a customer inquiry through Pro Direct support.

Select in-scope VM's by Tag

It would be very useful to be able to filter a subset of VM's to start/stop via a tag.

Is this feature on the backlog?

Open sourcing code

This looks like an interesting approach and I see that it's linked to in MS Docs.

Is there a particular reason why the source code is not open sourced? I see that the templates are available on the storage account, but the most important components for the functions are the DLLs, which are only available in compiled format.

Add Tag parameter please

Most organizations require Tagging resources at the policy level. Can someone please add that option in during deployment? Current workaround is to manually exempt the resource group, then tag the resources and re-add it.

Restart VM

Hi there,

Is there an action for "Restart" or do we need to schedule a stop and a start to reboot virtual machines?

StartStopV2_Dashboard

Hello,

I have tried to open the provided dashboard but there's no data returned.
There are logs under "traces" but the query is formed with the following where condition:
customDimensions.prop__Name == "VmExecutionsAttempted"
This does not return any result.
Has anyone been able to display data in a dashboard for StartStopV2 so far?

Roadmap for Start/Stop v2? Is there a committed schedule for Start/Stop v2 GA?

Thanks for putting together this solution. Is there a publicly announced date for Microsoft to make Start/Stop v2 generally available? Given the statement that the v1 solution support ends in 2022 I would like to know our options for long term support for this type of automated solution. Additionally, are there any plans to open source the underlying functions app?

Thanks again!

Savings & Cost Functions

The documentation mentions the below functions that calculates cost and savings. Where can I find more about these? Such as the result of them, how much has been saved by using the solution?

CostAnalyticsFunction: This function calculates the cost to run the Start/Stop V2 solution on a monthly basis.
SavingsAnalyticsFunction: This function calculates the total savings achieved by the Start/Stop V2 solution on a monthly basis.
VirtualMachineSavingsFunction: This function performs the actual savings calculation on a VM achieved by the Start/Stop V2 solution.

stsv2_vms_Sequenced_x ignores sequencestart and sequencestop tags

I've deployed the solution, and assigned the sequencestart and sequencestop tags to a subset of my virtual machines.

image

I then scheduled the stsv2_vms_Sequenced_start and stsv2_vms_Sequenced_stop logic apps:

image

And set the Request Body to:

{ "Action": "start", "EnableClassic": false, "RequestScopes": { "ExcludedVMLists": [], "Subscriptions": [ "/subscriptions/<my sub here>/" ] } }

When I trigger the logic app, all VMs in the subscription start/stop, regardless of whether the sequencestart and sequencestop tags have been set, or what their value are.

Does the RequestScopes override the sequencestart/sequencestop tags?

Possibility to parse email address provided?

So I didn't read the email address tooltip well enough and entered a semicolon delimited list of email address's.
As the deployment was expecting comma delimited, the deployment failed and it's fairly painful to debug or time consuming to delete the new resource group and create a resource group.
Is it possible to validate the email address's do not include a semicolon (or just replace them with comma's) ?

ExcludedVMLists property support for finding keywords in a VM name

Problem

I am trying to exclude a set of machines from being started on a schedule that are part of the included ResourceGroups but the name contains a specific key word. During my tests, the ExcludedVMLists expression is being ignored. Is the use of star (*) as part of the beginning of the expression not supported?

Example configuration of ststv2_vms_ScheduleStart_start

{
  "Action": "start",
  "EnableClassic": false,
  "RequestScopes": {
    "ResourceGroups": [
      "/subscriptions/11111111-0000-1111-2222-444444444444/resourceGroups/rg2/"
    ],
    "ExcludedVMLists": [
      "*doNotStart*"
    ]
  }
}

Ref: https://docs.microsoft.com/en-us/azure/azure-functions/start-stop-vms/deploy#scheduled-start-and-stop-scenario

Logic App shutdown the VM right after adding the VM to the Logic App

We run into another issue when adding systems to the Logic App. We added a system to Stop Logic App, few minutes after saving the Logic Apps the test VM stopped. After adding the same VM to the start logic app, the VM starts upon saving the logic app changes. Looks like the app triggers the action when the VM is first added to the logic app.

We added the VM in the afternoon and the Shutdown schedule is 7pm. Otherwise, the Stop/Start works according to the schedule.

Naming convention of created resources

Hi

I understand why it is a "nice" feature to append random characters at the end of the specified Function App and Storage Account names to ensure they are globally unique.

However, in our environment we have strict naming conventions, and the random characters break the convention. I'd much rather have the deployment fail due to a non-globally unique name, than have the generated resources break my naming convention.

As another naming-related feature request, could you make setting the name of the generated Dashboard user-definable during deployment as well?

Reserve ip address option

When manually stopping a VM via the azure portal, the is an option to reserve the ip address. Does this option exist in the automation? It is an essential option in certain use cases.

deploy into premium service plan (enhancement)

I have an enhancement that I would like to see.

It would be nice if we could deploy the function app into a premium service plan so that we could limit network access to the storage account to a vnet rather than leaving it internet facing.

Deploying the function app into a premium service plan would allow us to deploy this solution and still follow the Defender recommendation of limiting network access to storage accounts. If any credentials are compromised, having storage account access limited to a vnet would give us another layer of protection.

Dashboard not working

Hi,

I deployed the new Start Stop v2 solution.

Any ideas why the dashboard don't work / populate with data?

Thanks.
Screen Shot 2022-01-27 at 2 20 08 pm

Looking for Monthly occurrence scheduling options. Every 3rd Saturday etc..

Hi, I have fully deployed the Start/Stop VMs during off-hours overview (V2) solution in my environment. However I am not seeing any options for properly scheduling a monthly start stop occurrence. The options seems to be greatly limited. I'm only seeing an option to select a particular number value (say the 17th of each month) rather than say the 3rd or 4th Saturday of each month. Is there any option for this? Also if we need to schedule a start stop within less than 24 hours I'm not seeing a method to create a single occurrence. Is there any way to schedule a single occurrence (say I need to schedule a start/stop to run within next 4 hours)? The only way I'm seeing now is to manually trigger the start/stop logical app. I have also looked into trying to trigger the logical app using a scheduled task via PowerShell but have not been able to figure out how to get it to trigger automatically. Please note, I have a lot of PowerShell programming knowledge. I'm using the sequence start/stop (using tags) and this is working great. I'm only having issues with the scheduling.

New feature request: Notification asking if we'd like to Postpone/Skip Shutdown

Hello all,

I've been looking into your tool, which I really like but I was wondering if you may be able to add a new feature.
It the same way as the auto-shutdown already in place within the VM operations section. But now it would be for the whole set mentioned in the function. That way you won't have to manually set the configuration per VM and you would have a centralised location.

Basically an email could go out like bellow and ask the owner of the set of VM if he'd like to postpone the auto shutdown. If no response, the shutdown will happen.
2022-02-08_10-32-27

Thanks

Scheduled Start not working - Response status code does not indicate success: 400 (Bad Request)

I've just installed the latest code into public cloud using the appropriate button from the website.

It's a Hub and Spoke topology of Subscriptions and I've installed it into the Hub Subscription with a view to using it to manage VMs in the Hub and Spokes.

I've tried to run it for a Scheduled Resource Group level for the Development Spoke VMs which are in one Resource Group.

The JSON payload (redacted) is:

{
"Action": "stop",
"EnableClassic": false,
"RequestScopes": {
"ExcludedVMLists": [],
"ResourceGroups": [
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup-rg/"
]
}
}

I've given the Function App Contributor role on the Development Spoke Subscription (for now - will reduce but trying to get it to work initially).

I scheduled a run by editing the "ststv2_vms_Scheduled_stop" Logic App to configure the timings and enter the JSON payload, which validated and saved successfully.

I enabled the Logic App and it was executed on the schedule.

It fails with this error in the Logic App output:

{
"Message": "An error has occurred.",
"ExceptionMessage": "Response status code does not indicate success: 400 (Bad Request).",
"ExceptionType": "System.Net.Http.HttpRequestException",
"StackTrace": " at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\r\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionClassicVirtualMachinesAsync(String subscriptionId) in D:\a\1\s\StartStopAzureFunctions\Clients\AzureVirtualMachineClient.cs:line 151\r\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionVirtualMachinesAsync(String subscriptionId) in D:\a\1\s\StartStopAzureFunctions\Clients\AzureVirtualMachineClient.cs:line 99\r\n at StartStopAzureFunctions.BusinessLogic.UserRequestTranslatorBL.GetAccessibleVmsForSubscriptionScopesAsync(IEnumerable`1 subscriptionIds) in D:\a\1\s\StartStopAzureFunctions\BusinessLogic\UserRequestTranslatorBL.cs:line 82\r\n at StartStopAzureFunctions.Workflows.VirtualMachineScheduledRequestWorkflow.StartWorkflowAsync(ScheduledRequest scheduledRequest) in D:\a\1\s\StartStopAzureFunctions\Workflows\VirtualMachineScheduledRequestWorkflow.cs:line 81\r\n at StartStopAzureFunctions.ScheduledRequestFunction.RunAsync(ScheduledRequest scheduledRequest) in D:\a\1\s\StartStopAzureFunctions\ScheduledRequestFunction.cs:line 40"
}

Ability to specify a tag/value filter to support dynamic scoping

We would like to automate start/stop for 100's of VMs across multiple subscriptions. Ideally we would define the logic app to execute across all VMs in a subscription and...

  1. exclude VMs with a specified tag/value pair such as "application: life-support-system"
  2. include VMs with a specified tag/value pair such as "environment: dev"

Can you take this up for consideration in the backlog please?

Logic apps will run when enabled outside recurrence

image

I wanted to schedule a stop for Saturday. I redeployed the default scheduled stop logic app, and configured it to deploy as 'Disabled'.

I confirmed the recurrence and the scope.

After enabling the logic app, the logic app ran and triggered a stop on all VMs in the scope.

My expectation, is that enabling the logic app would enable the schedule, and not run immediately.

Is this as intended? Or is this a bug?
If this is intended, do I need to modify the already enabled app to ensure I do not stop VMs unintentionally?

Scheduled start and stop not working on our subscription (error 400)

Hi! Im trying to use Start/Stop in 2 VMs we have in our subscription. However, it does not seem to be working.

It gives 400 bad request whenever it tries to execute the function
This is the error that appears, both in ScheduledStop and ScheduledStart

{
"Message": "An error has occurred.",
"ExceptionMessage": "Response status code does not indicate success: 400 (Bad Request).",
"ExceptionType": "System.Net.Http.HttpRequestException",
"StackTrace": " at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()\r\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionClassicVirtualMachinesAsync(String subscriptionId) in D:\a\1\s\StartStopAzureFunctions\Clients\AzureVirtualMachineClient.cs:line 149\r\n at StartStopAzureFunctions.Clients.AzureVirtualMachineClient.GetSubscriptionVirtualMachinesAsync(String subscriptionId, Boolean classicEnabled) in D:\a\1\s\StartStopAzureFunctions\Clients\AzureVirtualMachineClient.cs:line 96\r\n at StartStopAzureFunctions.BusinessLogic.UserRequestTranslatorBL.GetAccessibleVmsForSubscriptionScopesAsync(IEnumerable`1 subscriptionIds, Boolean classicEnabled) in D:\a\1\s\StartStopAzureFunctions\BusinessLogic\UserRequestTranslatorBL.cs:line 70\r\n at StartStopAzureFunctions.Workflows.VirtualMachineScheduledRequestWorkflow.StartWorkflowAsync(ScheduledRequest scheduledRequest) in D:\a\1\s\StartStopAzureFunctions\Workflows\VirtualMachineScheduledRequestWorkflow.cs:line 83\r\n at StartStopAzureFunctions.ScheduledRequestFunction.RunAsync(ScheduledRequest scheduledRequest) in D:\a\1\s\StartStopAzureFunctions\ScheduledRequestFunction.cs:line 32"
}

Things I checked/tried:

  • Checked that the function has collaborator permissions on the subscription and in the VMs.
  • Redeploying the solution
  • Changing the scope of the function: I tried both trying to start and stop the whole subscription, and also tried to specify the 2 VMs. In both cases it fails in the same way.

Let me know if there is anything else I can share with you.

Logic app succeeds, but the VM doesn't shutdown

I have followed the directions to configure a single vm to shutdown. It's a scheduled shutdown. I have tested it by running the trigger manually as well as setting the time. All instances run successfully, however, the VM never shuts down. I was previously using the V1 version and did not have any issues with the process. The solution is installed under a different subscription, however I updated the target subscription with the 'contributer' permissions.
I have included a couple of screenshots including the inputs for the scheduled logic app.
image

Question re: Sequence delays

With previous start/stop runbooks we had to build in a delay between starting a SQL database VM and starting associated apps - time to allow SQL to properly start up. In testing starting a couple of VMs in sequence with StartStopV2, it seems that the 2nd VM doesn't begin to start until the 1st VM has completely started... but that could be coincidence.

Can anybody explain the logic of the sequencing in this case? Does it wait for the previous VM to be fully started (maybe the Azure Agent is up, etc?) before moving on to the next?

If not, short of having multiple functions to start the database then pause, is there a way to include a delay such as this in the main request body of the start action?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.